From 0c7735e525a22d523d5951fdcf65877d470d32fe Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 18 Oct 2011 15:50:50 +0000 Subject: [libclang] Index implicit property references. llvm-svn: 142355 --- clang/tools/libclang/IndexBody.cpp | 15 +++++++++++++++ clang/tools/libclang/IndexingContext.cpp | 6 ++++-- clang/tools/libclang/IndexingContext.h | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'clang/tools/libclang') diff --git a/clang/tools/libclang/IndexBody.cpp b/clang/tools/libclang/IndexBody.cpp index b2ffb99267e..769a1c7ae81 100644 --- a/clang/tools/libclang/IndexBody.cpp +++ b/clang/tools/libclang/IndexBody.cpp @@ -69,6 +69,21 @@ public: IndexCtx.handleReference(MD, E->getSelectorStartLoc(), 0, ParentDC, E); return true; } + + bool VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { + if (E->isImplicitProperty()) { + if (ObjCMethodDecl *MD = E->getImplicitPropertyGetter()) + IndexCtx.handleReference(MD, E->getLocation(), 0, ParentDC, E, + CXIdxEntityRef_ImplicitProperty); + if (ObjCMethodDecl *MD = E->getImplicitPropertySetter()) + IndexCtx.handleReference(MD, E->getLocation(), 0, ParentDC, E, + CXIdxEntityRef_ImplicitProperty); + } else { + IndexCtx.handleReference(E->getExplicitProperty(), E->getLocation(), 0, + ParentDC, E); + } + return true; + } }; } // anonymous namespace diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index 8a41856032a..f295582b535 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -388,7 +388,8 @@ void IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) { void IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, const NamedDecl *Parent, const DeclContext *DC, - const Expr *E) { + const Expr *E, + CXIdxEntityRefKind Kind) { if (Loc.isInvalid()) return; if (!CB.indexEntityReference) @@ -402,7 +403,8 @@ void IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, getIndexLoc(Loc), getIndexEntity(D), getIndexEntity(Parent), - getIndexContainerForDC(DC) }; + getIndexContainerForDC(DC), + Kind }; CB.indexEntityReference(ClientData, &Info); } diff --git a/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h index 710568058f5..d69f1c8eaa9 100644 --- a/clang/tools/libclang/IndexingContext.h +++ b/clang/tools/libclang/IndexingContext.h @@ -132,7 +132,8 @@ public: void handleReference(const NamedDecl *D, SourceLocation Loc, const NamedDecl *Parent, const DeclContext *DC, - const Expr *E = 0); + const Expr *E = 0, + CXIdxEntityRefKind Kind = CXIdxEntityRef_Direct); void invokeStartedTagTypeDefinition(const TagDecl *D); -- cgit v1.2.3