aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-23 16:58:36 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-23 16:58:36 +0000
commit8818d4570b916762513e2b5ec4ca7178b1e736a9 (patch)
tree804682e0aeadc87b31e549e2c572fc6ee652de92 /tools/libclang/IndexDecl.cpp
parent7f6cf9764b33381e03fcf7c44f7985a333212b06 (diff)
[libclang] Index C++ constructor initializers, rdar://10732164
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148705 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexDecl.cpp')
-rw-r--r--tools/libclang/IndexDecl.cpp16
1 files changed, 16 insertions, 0 deletions
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<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) {