[cfe-commits] r146019 - in /cfe/trunk/tools/libclang: IndexDecl.cpp IndexingContext.cpp IndexingContext.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Dec 6 21:52:06 PST 2011


Author: akirtzidis
Date: Tue Dec  6 23:52:06 2011
New Revision: 146019

URL: http://llvm.org/viewvc/llvm-project?rev=146019&view=rev
Log:
[libclang] Index C++ namespaces.

Modified:
    cfe/trunk/tools/libclang/IndexDecl.cpp
    cfe/trunk/tools/libclang/IndexingContext.cpp
    cfe/trunk/tools/libclang/IndexingContext.h

Modified: cfe/trunk/tools/libclang/IndexDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexDecl.cpp?rev=146019&r1=146018&r2=146019&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexDecl.cpp (original)
+++ cfe/trunk/tools/libclang/IndexDecl.cpp Tue Dec  6 23:52:06 2011
@@ -189,6 +189,12 @@
     return true;
   }
 
+  bool VisitNamespaceDecl(NamespaceDecl *D) {
+    IndexCtx.handleNamespace(D);
+    IndexCtx.indexDeclContext(D);
+    return true;
+  }
+
   bool VisitClassTemplateDecl(ClassTemplateDecl *D) {
     IndexCtx.handleClassTemplate(D);
     if (D->isThisDeclarationADefinition())

Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=146019&r1=146018&r2=146019&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Tue Dec  6 23:52:06 2011
@@ -401,6 +401,13 @@
   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);
 }

Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=146019&r1=146018&r2=146019&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Tue Dec  6 23:52:06 2011
@@ -370,6 +370,8 @@
 
   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);





More information about the cfe-commits mailing list