r260250 - [libclang] indexing: Have the semantic container of synthesized ObjC getter/setter methods be the implementation decl.
Argyrios Kyrtzidis via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 9 11:07:08 PST 2016
Author: akirtzidis
Date: Tue Feb 9 13:07:07 2016
New Revision: 260250
URL: http://llvm.org/viewvc/llvm-project?rev=260250&view=rev
Log:
[libclang] indexing: Have the semantic container of synthesized ObjC getter/setter methods be the implementation decl.
Matches the behavior of other ObjC methods.
Modified:
cfe/trunk/tools/libclang/IndexingContext.cpp
cfe/trunk/tools/libclang/IndexingContext.h
Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=260250&r1=260249&r2=260250&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Tue Feb 9 13:07:07 2016
@@ -309,7 +309,8 @@ void IndexingContext::handleDiagnosticSe
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 N
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::handleSynthesizedO
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) {
Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=260250&r1=260249&r2=260250&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Tue Feb 9 13:07:07 2016
@@ -468,7 +468,8 @@ private:
bool handleDecl(const NamedDecl *D,
SourceLocation Loc, CXCursor Cursor,
DeclInfo &DInfo,
- const DeclContext *LexicalDC = nullptr);
+ const DeclContext *LexicalDC = nullptr,
+ const DeclContext *SemaDC = nullptr);
bool handleObjCContainer(const ObjCContainerDecl *D,
SourceLocation Loc, CXCursor Cursor,
More information about the cfe-commits
mailing list