Builder : RecursiveASTVisitor<Builder> {
24ASTImporterLookupTable &
LT;
25Builder(ASTImporterLookupTable <) :
LT(
LT) {}
27 boolVisitTypedefNameDecl(TypedefNameDecl *
D) {
28QualType Ty =
D->getUnderlyingType();
29Ty = Ty.getCanonicalType();
30 if(
const auto*RTy = dyn_cast<RecordType>(Ty)) {
31 LT.add(RTy->getAsRecordDecl());
33 for(
auto*it : RTy->getAsRecordDecl()->fields()) {
40 boolVisitNamedDecl(NamedDecl *
D) {
49 boolVisitFriendDecl(FriendDecl *
D) {
50 if(
D->getFriendType()) {
51QualType Ty =
D->getFriendType()->getType();
52 if(isa<ElaboratedType>(Ty))
53Ty = cast<ElaboratedType>(Ty)->getNamedType();
58 if(!Ty->isDependentType()) {
59 if(
const auto*RTy = dyn_cast<RecordType>(Ty))
60 LT.add(RTy->getAsCXXRecordDecl());
61 else if(
const auto*SpecTy = dyn_cast<TemplateSpecializationType>(Ty))
62 LT.add(SpecTy->getAsCXXRecordDecl());
63 else if(
const auto*SubstTy =
64dyn_cast<SubstTemplateTypeParmType>(Ty)) {
65 if(SubstTy->getAsCXXRecordDecl())
66 LT.add(SubstTy->getAsCXXRecordDecl());
67}
else if(isa<TypedefType>(Ty)) {
70}
else if(isa<UsingType>(Ty)) {
73llvm_unreachable(
"Unhandled type of friend class");
81 boolshouldVisitTemplateInstantiations()
const{
return true; }
82 boolshouldVisitImplicitCode()
const{
return true; }
98 if(
auto*Ns = dyn_cast<NamespaceDecl>(
D->getDeclContext()))
100add(
D->getDeclContext(),
D);
105DeclList &Decls = LookupTable[DC][ND->
getDeclName()];
110voidASTImporterLookupTable::remove(DeclContext *DC, NamedDecl *ND) {
111 constDeclarationName Name = ND->getDeclName();
112DeclList &Decls = LookupTable[DC][Name];
113 boolEraseResult = Decls.remove(ND);
117std::string Message =
119 "Trying to remove not contained Decl '{0}' of type {1} from a {2}",
120Name.getAsString(), ND->getDeclKindName(), DC->getDeclKindName())
122llvm_unreachable(Message.c_str());
147 "DeclContext should be changed before update");
150 "Decl should not be found in the old context if already in the new");
159LookupTable[OldDC][ND->
getDeclName()].remove(ND);
165 autoDCI = LookupTable.find(DC);
166 if(DCI == LookupTable.end())
169 const auto&FoundNameMap = DCI->second;
170 autoNamesI = FoundNameMap.find(Name);
171 if(NamesI == FoundNameMap.end())
174 returnNamesI->second;
182 autoDCI = LookupTable.find(DC);
183 if(DCI == LookupTable.end())
184llvm::errs() <<
"empty\n";
185 const auto&FoundNameMap = DCI->second;
186 for(
const auto&Entry : FoundNameMap) {
188llvm::errs() <<
"==== Name: ";
190 const DeclList& List = Entry.second;
198 for(
const auto&Entry : LookupTable) {
200llvm::errs() <<
"== DC:"<< cast<Decl>(DC) <<
"\n";
ASTImporterLookupTable & LT
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
void update(NamedDecl *ND, DeclContext *OldDC)
LookupResult lookup(DeclContext *DC, DeclarationName Name) const
void updateForced(NamedDecl *ND, DeclContext *OldDC)
ASTImporterLookupTable(TranslationUnitDecl &TU)
bool contains(DeclContext *DC, NamedDecl *ND) const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
DeclContext * getDeclContext()
The name of a declaration.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
The top declaration context.
ASTContext & getASTContext() const
The JSON file list parser is used to communicate input to InstallAPI.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4