diff options
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 6797cc244a..c9150b9a5d 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -257,7 +257,8 @@ void IndexingContext::handleDiagnosticSet(CXDiagnostic CXDiagSet) { bool IndexingContext::handleDecl(const NamedDecl *D, SourceLocation Loc, CXCursor Cursor, - DeclInfo &DInfo) { + DeclInfo &DInfo, + const DeclContext *LexicalDC) { if (!CB.indexDeclaration || !D) return false; if (D->isImplicit() && shouldIgnoreIfImplicit(D)) @@ -269,6 +270,9 @@ bool IndexingContext::handleDecl(const NamedDecl *D, || Loc.isInvalid()) return false; + if (!LexicalDC) + LexicalDC = D->getLexicalDeclContext(); + if (shouldSuppressRefs()) markEntityOccurrenceInFile(D, Loc); @@ -284,7 +288,7 @@ bool IndexingContext::handleDecl(const NamedDecl *D, getContainerInfo(D->getDeclContext(), DInfo.SemanticContainer); DInfo.semanticContainer = &DInfo.SemanticContainer; - if (D->getLexicalDeclContext() == D->getDeclContext()) { + if (LexicalDC == D->getDeclContext()) { DInfo.lexicalContainer = &DInfo.SemanticContainer; } else if (isTemplateImplicitInstantiation(D)) { // Implicit instantiations have the lexical context of where they were @@ -295,7 +299,7 @@ bool IndexingContext::handleDecl(const NamedDecl *D, // information anyway. DInfo.lexicalContainer = &DInfo.SemanticContainer; } else { - getContainerInfo(D->getLexicalDeclContext(), DInfo.LexicalContainer); + getContainerInfo(LexicalDC, DInfo.LexicalContainer); DInfo.lexicalContainer = &DInfo.LexicalContainer; } @@ -510,10 +514,11 @@ bool IndexingContext::handleSynthesizedObjCProperty( } bool IndexingContext::handleSynthesizedObjCMethod(const ObjCMethodDecl *D, - SourceLocation Loc) { + SourceLocation Loc, + const DeclContext *LexicalDC) { DeclInfo DInfo(/*isRedeclaration=*/true, /*isDefinition=*/true, /*isContainer=*/false); - return handleDecl(D, Loc, getCursor(D), DInfo); + return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC); } bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) { |