From: Argyrios Kyrtzidis Date: Mon, 23 Jan 2012 16:58:36 +0000 (+0000) Subject: [libclang] Index C++ constructor initializers, rdar://10732164 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8818d4570b916762513e2b5ec4ca7178b1e736a9;p=clang [libclang] Index C++ constructor initializers, rdar://10732164 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148705 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index fb4194c8cd..c6080df592 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -44,6 +44,22 @@ public: bool VisitFunctionDecl(FunctionDecl *D) { IndexCtx.handleFunction(D); handleDeclarator(D); + + if (CXXConstructorDecl *Ctor = dyn_cast(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) {