summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/IndexBody.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-18 00:26:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-18 00:26:51 +0000
commiteffdbf55acb208f4c0f302903c0333d46146b7f2 (patch)
tree9124b92d9b641bda72d117c5a8149b1ef634f1d2 /clang/tools/libclang/IndexBody.cpp
parent1cff795e5118f71d0529a4800a8af67ea400c0ba (diff)
downloadbcm5719-llvm-effdbf55acb208f4c0f302903c0333d46146b7f2.tar.gz
bcm5719-llvm-effdbf55acb208f4c0f302903c0333d46146b7f2.zip
[libclang] Indexing API:
-For indexDeclaration, also pass the declaration attributes as an array of cursors. -Rename CXIndexOpt_OneRefPerFile -> CXIndexOpt_SuppressRedundantRefs, and only pass a reference if a declaration/definition does not exist in the file. -Other fixes. llvm-svn: 144942
Diffstat (limited to 'clang/tools/libclang/IndexBody.cpp')
-rw-r--r--clang/tools/libclang/IndexBody.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/clang/tools/libclang/IndexBody.cpp b/clang/tools/libclang/IndexBody.cpp
index ece1ed429ca..60fe2cf021e 100644
--- a/clang/tools/libclang/IndexBody.cpp
+++ b/clang/tools/libclang/IndexBody.cpp
@@ -10,6 +10,7 @@
#include "IndexingContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Analysis/Support/SaveAndRestore.h"
using namespace clang;
using namespace cxindex;
@@ -19,10 +20,12 @@ namespace {
class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
IndexingContext &IndexCtx;
const DeclContext *ParentDC;
+ bool InPseudoObject;
+ typedef RecursiveASTVisitor<BodyIndexer> base;
public:
BodyIndexer(IndexingContext &indexCtx, const DeclContext *DC)
- : IndexCtx(indexCtx), ParentDC(DC) { }
+ : IndexCtx(indexCtx), ParentDC(DC), InPseudoObject(false) { }
bool shouldWalkTypesOfTypeLocs() const { return false; }
@@ -48,8 +51,13 @@ public:
}
bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
+ if (TypeSourceInfo *Cls = E->getClassReceiverTypeInfo())
+ IndexCtx.indexTypeSourceInfo(Cls, 0, ParentDC);
+
if (ObjCMethodDecl *MD = E->getMethodDecl())
- IndexCtx.handleReference(MD, E->getSelectorStartLoc(), 0, ParentDC, E);
+ IndexCtx.handleReference(MD, E->getSelectorStartLoc(), 0, ParentDC, E,
+ InPseudoObject ? CXIdxEntityRef_Implicit
+ : CXIdxEntityRef_Direct);
return true;
}
@@ -57,16 +65,21 @@ public:
if (E->isImplicitProperty()) {
if (ObjCMethodDecl *MD = E->getImplicitPropertyGetter())
IndexCtx.handleReference(MD, E->getLocation(), 0, ParentDC, E,
- CXIdxEntityRef_ImplicitProperty);
+ CXIdxEntityRef_Implicit);
if (ObjCMethodDecl *MD = E->getImplicitPropertySetter())
IndexCtx.handleReference(MD, E->getLocation(), 0, ParentDC, E,
- CXIdxEntityRef_ImplicitProperty);
+ CXIdxEntityRef_Implicit);
} else {
IndexCtx.handleReference(E->getExplicitProperty(), E->getLocation(), 0,
ParentDC, E);
}
return true;
}
+
+ bool TraversePseudoObjectExpr(PseudoObjectExpr *E) {
+ SaveAndRestore<bool> InPseudo(InPseudoObject, true);
+ return base::TraversePseudoObjectExpr(E);
+ }
};
} // anonymous namespace
OpenPOWER on IntegriCloud