Lines Matching +full:2 +full:nd

26   enum RootDeclOrigin { TopLevel = 0, FromTU = 1, IsLate = 2 };
41 bool WriteNamedDecl(const NamedDecl *ND, MangledSymbols &Symbols, int RDO) {
49 auto isVisible = [](const NamedDecl *ND) -> bool {
50 return ND->getVisibility() == DefaultVisibility;
53 auto ignoreDecl = [this, isVisible](const NamedDecl *ND) -> bool {
54 if (!isVisible(ND))
57 if (const VarDecl *VD = dyn_cast<VarDecl>(ND)) {
68 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
85 auto getParentFunctionDecl = [](const NamedDecl *ND) -> const NamedDecl * {
86 if (const VarDecl *VD = dyn_cast<VarDecl>(ND))
93 auto getMangledNames = [](const NamedDecl *ND) -> std::vector<std::string> {
94 if (!ND)
96 ASTNameGenerator NameGen(ND->getASTContext());
97 std::vector<std::string> MangledNames = NameGen.getAllManglings(ND);
98 if (isa<CXXConstructorDecl>(ND) || isa<CXXDestructorDecl>(ND))
103 return {NameGen.getName(ND)};
108 if (Symbols.find(ND) != Symbols.end())
112 if (isa<FieldDecl>(ND) || isa<ParmVarDecl>(ND))
115 const NamedDecl *ParentDecl = getParentFunctionDecl(ND);
116 if ((ParentDecl && ignoreDecl(ParentDecl)) || ignoreDecl(ND))
124 if (const auto *FD = dyn_cast<FunctionDecl>(ND))
128 const bool IsWeak = (ND->hasAttr<WeakAttr>() ||
129 ND->hasAttr<WeakRefAttr>() || ND->isWeakImported());
132 ND,
135 isa<VarDecl>(ND) ? llvm::ELF::STT_OBJECT
139 getMangledNames(ND))));
163 bool HandleNamedDecl(const NamedDecl *ND, MangledSymbols &Symbols, int RDO) {
164 if (!ND)
167 switch (ND->getKind()) {
171 HandleDecls(cast<NamespaceDecl>(ND)->decls(), Symbols, RDO);
174 HandleDecls(cast<CXXRecordDecl>(ND)->decls(), Symbols, RDO);
177 HandleDecls(cast<ClassTemplateSpecializationDecl>(ND)->decls(), Symbols,
181 HandleTemplateSpecializations(*cast<ClassTemplateDecl>(ND), Symbols, RDO);
184 HandleTemplateSpecializations(*cast<FunctionTemplateDecl>(ND), Symbols,
212 if (!ND->getIdentifier())
214 const auto *VD = cast<VarDecl>(ND);
218 if (WriteNamedDecl(ND, Symbols, RDO))
228 if (WriteNamedDecl(ND, Symbols, RDO))
246 bool VisitNamedDecl(NamedDecl *ND) {
247 if (const auto *FD = dyn_cast<FunctionDecl>(ND))
253 if (const auto *VD = dyn_cast<ValueDecl>(ND)) {
258 NamedDecls.insert(ND);
284 for (const NamedDecl *ND : v.ValueDecls)
285 HandleNamedDecl(ND, Symbols, FromTU);
286 for (const NamedDecl *ND : v.NamedDecls)
287 HandleNamedDecl(ND, Symbols, FromTU);