]> granicus.if.org Git - clang/commitdiff
[libclang] Index C++ namespaces.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 7 Dec 2011 05:52:06 +0000 (05:52 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 7 Dec 2011 05:52:06 +0000 (05:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146019 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/IndexDecl.cpp
tools/libclang/IndexingContext.cpp
tools/libclang/IndexingContext.h

index 0970054575b98196e3b8e9fd1562af866437e718..84c1134501143c8598c32996fd20b2b0a9f1a4dc 100644 (file)
@@ -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())
index f597797132409a804e25b2a8a9179d8876d6a812..3f934be8a006da2a70826d5376b8a8cdc76337e1 100644 (file)
@@ -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);
 }
index 6f33e194fd50db8de8b4b88f53202bbb9df26ed6..a8a8edb36299d279dfca828e76b47654f2baaafb 100644 (file)
@@ -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);