diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-18 15:50:50 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-18 15:50:50 +0000 |
| commit | 0c7735e525a22d523d5951fdcf65877d470d32fe (patch) | |
| tree | f94a62e7ea939d0a5cc7aea99040f03a7451906c /clang/tools/libclang | |
| parent | 1c7dcd04b84d6be013132fdb8a25508ae21bcad0 (diff) | |
| download | bcm5719-llvm-0c7735e525a22d523d5951fdcf65877d470d32fe.tar.gz bcm5719-llvm-0c7735e525a22d523d5951fdcf65877d470d32fe.zip | |
[libclang] Index implicit property references.
llvm-svn: 142355
Diffstat (limited to 'clang/tools/libclang')
| -rw-r--r-- | clang/tools/libclang/IndexBody.cpp | 15 | ||||
| -rw-r--r-- | clang/tools/libclang/IndexingContext.cpp | 6 | ||||
| -rw-r--r-- | clang/tools/libclang/IndexingContext.h | 3 |
3 files changed, 21 insertions, 3 deletions
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); |

