22 struct Builder : RecursiveASTVisitor<Builder> {
23 ASTImporterLookupTable &
LT;
24 Builder(ASTImporterLookupTable <) : LT(LT) {}
25 bool VisitNamedDecl(NamedDecl *D) {
34 bool VisitFriendDecl(FriendDecl *D) {
35 if (D->getFriendType()) {
36 QualType Ty = D->getFriendType()->getType();
37 if (isa<ElaboratedType>(Ty))
38 Ty = cast<ElaboratedType>(Ty)->getNamedType();
43 if (!Ty->isDependentType()) {
44 if (
const auto *RTy = dyn_cast<RecordType>(Ty))
45 LT.add(RTy->getAsCXXRecordDecl());
46 else if (
const auto *SpecTy = dyn_cast<TemplateSpecializationType>(Ty))
47 LT.add(SpecTy->getAsCXXRecordDecl());
48 else if (isa<TypedefType>(Ty)) {
52 llvm_unreachable(
"Unhandled type of friend class");
60 bool shouldVisitTemplateInstantiations()
const {
return true; }
61 bool shouldVisitImplicitCode()
const {
return true; }
79 bool EraseResult = Decls.remove(ND);
81 assert(EraseResult ==
true &&
"Trying to remove not contained Decl");
93 void ASTImporterLookupTable::remove(
NamedDecl *ND) {
105 if (DCI == LookupTable.end())
108 const auto &FoundNameMap = DCI->second;
109 auto NamesI = FoundNameMap.find(Name);
110 if (NamesI == FoundNameMap.end())
113 return NamesI->second;
118 if (DCI == LookupTable.end())
119 llvm::errs() <<
"empty\n";
120 const auto &FoundNameMap = DCI->second;
121 for (
const auto &Entry : FoundNameMap) {
123 llvm::errs() <<
"==== Name: ";
125 const DeclList& List = Entry.second;
133 for (
const auto &Entry : LookupTable) {
136 llvm::errs() <<
"== DC:" << cast<Decl>(DC) << Primary <<
"\n";
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
LookupResult lookup(DeclContext *DC, DeclarationName Name) const
DeclContext * getDeclContext()
ASTImporterLookupTable(TranslationUnitDecl &TU)
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The name of a declaration.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ASTImporterLookupTable & LT
The top declaration context.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
This represents a decl that may have a name.