[cfe-commits] r144764 - in /cfe/trunk/tools/libclang: IndexBody.cpp IndexTypeSourceInfo.cpp IndexingContext.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Nov 15 18:35:02 PST 2011
Author: akirtzidis
Date: Tue Nov 15 20:35:01 2011
New Revision: 144764
URL: http://llvm.org/viewvc/llvm-project?rev=144764&view=rev
Log:
[libclang] Indexing API: make sure we do not try to index local declarations.
Modified:
cfe/trunk/tools/libclang/IndexBody.cpp
cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp
cfe/trunk/tools/libclang/IndexingContext.cpp
Modified: cfe/trunk/tools/libclang/IndexBody.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexBody.cpp?rev=144764&r1=144763&r2=144764&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexBody.cpp (original)
+++ cfe/trunk/tools/libclang/IndexBody.cpp Tue Nov 15 20:35:01 2011
@@ -32,35 +32,18 @@
}
bool VisitDeclRefExpr(DeclRefExpr *E) {
- const NamedDecl *D = E->getDecl();
- if (!D)
- return true;
- if (D->getParentFunctionOrMethod())
- return true;
-
- IndexCtx.handleReference(D, E->getLocation(), 0, ParentDC, E);
+ IndexCtx.handleReference(E->getDecl(), E->getLocation(), 0, ParentDC, E);
return true;
}
bool VisitMemberExpr(MemberExpr *E) {
- const NamedDecl *D = E->getMemberDecl();
- if (!D)
- return true;
- if (D->getParentFunctionOrMethod())
- return true;
-
- IndexCtx.handleReference(D, E->getMemberLoc(), 0, ParentDC, E);
+ IndexCtx.handleReference(E->getMemberDecl(), E->getMemberLoc(), 0, ParentDC,
+ E);
return true;
}
bool VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
- const NamedDecl *D = E->getDecl();
- if (!D)
- return true;
- if (D->getParentFunctionOrMethod())
- return true;
-
- IndexCtx.handleReference(D, E->getLocation(), 0, ParentDC, E);
+ IndexCtx.handleReference(E->getDecl(), E->getLocation(), 0, ParentDC, E);
return true;
}
Modified: cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp?rev=144764&r1=144763&r2=144764&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp (original)
+++ cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp Tue Nov 15 20:35:01 2011
@@ -36,6 +36,8 @@
bool VisitTagTypeLoc(TagTypeLoc TL) {
TagDecl *D = TL.getDecl();
+ if (D->getParentFunctionOrMethod())
+ return true;
if (TL.isDefinition()) {
IndexCtx.indexTagDecl(D);
Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=144764&r1=144763&r2=144764&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Tue Nov 15 20:35:01 2011
@@ -283,6 +283,10 @@
const DeclContext *DC,
const Expr *E,
CXIdxEntityRefKind Kind) {
+ if (!D)
+ return;
+ if (D->getParentFunctionOrMethod())
+ return;
if (Loc.isInvalid())
return;
if (!CB.indexEntityReference)
More information about the cfe-commits
mailing list