summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-07 05:52:06 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-07 05:52:06 +0000
commit2b0b43cf56fc46fc94a734413748878211651a8b (patch)
treef5ba36c392134be93a37f5854045b0bbd3571645 /clang/tools/libclang
parent2f0400b780a8e00511f16483a417ece6c54e0b81 (diff)
downloadbcm5719-llvm-2b0b43cf56fc46fc94a734413748878211651a8b.tar.gz
bcm5719-llvm-2b0b43cf56fc46fc94a734413748878211651a8b.zip
[libclang] Index C++ namespaces.
llvm-svn: 146019
Diffstat (limited to 'clang/tools/libclang')
-rw-r--r--clang/tools/libclang/IndexDecl.cpp6
-rw-r--r--clang/tools/libclang/IndexingContext.cpp7
-rw-r--r--clang/tools/libclang/IndexingContext.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/clang/tools/libclang/IndexDecl.cpp b/clang/tools/libclang/IndexDecl.cpp
index 0970054575b..84c11345011 100644
--- a/clang/tools/libclang/IndexDecl.cpp
+++ b/clang/tools/libclang/IndexDecl.cpp
@@ -189,6 +189,12 @@ public:
return true;
}
+ bool VisitNamespaceDecl(NamespaceDecl *D) {
+ IndexCtx.handleNamespace(D);
+ IndexCtx.indexDeclContext(D);
+ return true;
+ }
+
bool VisitClassTemplateDecl(ClassTemplateDecl *D) {
IndexCtx.handleClassTemplate(D);
if (D->isThisDeclarationADefinition())
diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp
index f5977971324..3f934be8a00 100644
--- a/clang/tools/libclang/IndexingContext.cpp
+++ b/clang/tools/libclang/IndexingContext.cpp
@@ -401,6 +401,13 @@ bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) {
return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
}
+bool IndexingContext::handleNamespace(const NamespaceDecl *D) {
+ DeclInfo DInfo(/*isRedeclaration=*/!D->isOriginalNamespace(),
+ /*isDefinition=*/true,
+ /*isContainer=*/true);
+ return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
+}
+
bool IndexingContext::handleClassTemplate(const ClassTemplateDecl *D) {
return handleCXXRecordDecl(D->getTemplatedDecl(), D);
}
diff --git a/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h
index 6f33e194fd5..a8a8edb3629 100644
--- a/clang/tools/libclang/IndexingContext.h
+++ b/clang/tools/libclang/IndexingContext.h
@@ -370,6 +370,8 @@ public:
bool handleObjCProperty(const ObjCPropertyDecl *D);
+ bool handleNamespace(const NamespaceDecl *D);
+
bool handleClassTemplate(const ClassTemplateDecl *D);
bool handleFunctionTemplate(const FunctionTemplateDecl *D);
bool handleTypeAliasTemplate(const TypeAliasTemplateDecl *D);
OpenPOWER on IntegriCloud