summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/IndexBody.cpp
diff options
context:
space:
mode:
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