diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-09 19:07:07 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-09 19:07:07 +0000 |
commit | af75b197363fd65d53e2d32773523d051656a7fa (patch) | |
tree | 894b0cdec66f6959db89850e5d91775327e6f5af /clang/tools/libclang/IndexingContext.cpp | |
parent | b5933d7bdef728a2f39e795bd8809821fc166a96 (diff) | |
download | bcm5719-llvm-af75b197363fd65d53e2d32773523d051656a7fa.tar.gz bcm5719-llvm-af75b197363fd65d53e2d32773523d051656a7fa.zip |
[libclang] indexing: Have the semantic container of synthesized ObjC getter/setter methods be the implementation decl.
Matches the behavior of other ObjC methods.
llvm-svn: 260250
Diffstat (limited to 'clang/tools/libclang/IndexingContext.cpp')
-rw-r--r-- | clang/tools/libclang/IndexingContext.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index f7640c63e05..5d944bae1cb 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -309,7 +309,8 @@ void IndexingContext::handleDiagnosticSet(CXDiagnostic CXDiagSet) { bool IndexingContext::handleDecl(const NamedDecl *D, SourceLocation Loc, CXCursor Cursor, DeclInfo &DInfo, - const DeclContext *LexicalDC) { + const DeclContext *LexicalDC, + const DeclContext *SemaDC) { if (!CB.indexDeclaration || !D) return false; if (D->isImplicit() && shouldIgnoreIfImplicit(D)) @@ -335,10 +336,12 @@ bool IndexingContext::handleDecl(const NamedDecl *D, DInfo.attributes = DInfo.EntInfo.attributes; DInfo.numAttributes = DInfo.EntInfo.numAttributes; - getContainerInfo(D->getDeclContext(), DInfo.SemanticContainer); + if (!SemaDC) + SemaDC = D->getDeclContext(); + getContainerInfo(SemaDC, DInfo.SemanticContainer); DInfo.semanticContainer = &DInfo.SemanticContainer; - if (LexicalDC == D->getDeclContext()) { + if (LexicalDC == SemaDC) { DInfo.lexicalContainer = &DInfo.SemanticContainer; } else if (isTemplateImplicitInstantiation(D)) { // Implicit instantiations have the lexical context of where they were @@ -598,7 +601,7 @@ bool IndexingContext::handleSynthesizedObjCMethod(const ObjCMethodDecl *D, const DeclContext *LexicalDC) { DeclInfo DInfo(/*isRedeclaration=*/true, /*isDefinition=*/true, /*isContainer=*/false); - return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC); + return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC, LexicalDC); } bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) { |