[cfe-commits] r148705 - /cfe/trunk/tools/libclang/IndexDecl.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Jan 23 08:58:36 PST 2012


Author: akirtzidis
Date: Mon Jan 23 10:58:36 2012
New Revision: 148705

URL: http://llvm.org/viewvc/llvm-project?rev=148705&view=rev
Log:
[libclang] Index C++ constructor initializers, rdar://10732164

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

Modified: cfe/trunk/tools/libclang/IndexDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexDecl.cpp?rev=148705&r1=148704&r2=148705&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexDecl.cpp (original)
+++ cfe/trunk/tools/libclang/IndexDecl.cpp Mon Jan 23 10:58:36 2012
@@ -44,6 +44,22 @@
   bool VisitFunctionDecl(FunctionDecl *D) {
     IndexCtx.handleFunction(D);
     handleDeclarator(D);
+
+    if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
+      // Constructor initializers.
+      for (CXXConstructorDecl::init_iterator I = Ctor->init_begin(),
+                                             E = Ctor->init_end();
+           I != E; ++I) {
+        CXXCtorInitializer *Init = *I;
+        if (Init->isWritten()) {
+          IndexCtx.indexTypeSourceInfo(Init->getTypeSourceInfo(), D);
+          if (const FieldDecl *Member = Init->getAnyMember())
+            IndexCtx.handleReference(Member, Init->getMemberLocation(), D, D);
+          IndexCtx.indexBody(Init->getInit(), D, D);
+        }
+      }
+    }
+
     if (D->isThisDeclarationADefinition()) {
       const Stmt *Body = D->getBody();
       if (Body) {





More information about the cfe-commits mailing list