aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-15 06:20:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-15 06:20:16 +0000
commit21ee5707e6e59d982d2f2ae28e079c7ff46dc519 (patch)
tree24099e80ee098567726affd8c2a19c73c20d9f61 /tools/libclang/IndexDecl.cpp
parentca3d3fcabaa0d7255e9a778ef468daa6e052b211 (diff)
[libclang] Introduce a new function to apply the indexing callbacks on an existing
CXTranslationUnit, mainly to be used for indexing a PCH. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexDecl.cpp')
-rw-r--r--tools/libclang/IndexDecl.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp
index 58f449d3cc..67f6703e75 100644
--- a/tools/libclang/IndexDecl.cpp
+++ b/tools/libclang/IndexDecl.cpp
@@ -172,17 +172,19 @@ void IndexingContext::indexDeclContext(const DeclContext *DC) {
}
}
-void IndexingContext::indexDeclGroupRef(DeclGroupRef DG) {
- for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I) {
- Decl *D = *I;
- if (isNotFromSourceFile(D->getLocation()))
- return;
+void IndexingContext::indexTopLevelDecl(Decl *D) {
+ if (isNotFromSourceFile(D->getLocation()))
+ return;
- if (isa<ObjCMethodDecl>(D))
- continue; // Wait for the objc container.
+ if (isa<ObjCMethodDecl>(D))
+ return; // Wait for the objc container.
- indexDecl(D);
- }
+ indexDecl(D);
+}
+
+void IndexingContext::indexDeclGroupRef(DeclGroupRef DG) {
+ for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I)
+ indexTopLevelDecl(*I);
}
void IndexingContext::indexTUDeclsInObjCContainer() {