diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-14 02:05:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-14 02:05:51 +0000 |
commit | db4d7a5f47d13bf346260ac35eaafd2c92e5606e (patch) | |
tree | 314c2623af67411aed9f8f32068a21b3c675f1b3 /tools/libclang/IndexDecl.cpp | |
parent | 093ecc92afb70f6125d249eef31f40c0c57b7d24 (diff) |
[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
index parameters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexDecl.cpp')
-rw-r--r-- | tools/libclang/IndexDecl.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index 9ff65b30f4..fb4194c8cd 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -25,8 +25,20 @@ public: void handleDeclarator(DeclaratorDecl *D, const NamedDecl *Parent = 0) { if (!Parent) Parent = D; - IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent); - IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent); + + if (!IndexCtx.indexFunctionLocalSymbols()) { + IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent); + IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent); + } else { + if (ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { + IndexCtx.handleVar(Parm); + } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { + for (FunctionDecl::param_iterator + PI = FD->param_begin(), PE = FD->param_end(); PI != PE; ++PI) { + IndexCtx.handleVar(*PI); + } + } + } } bool VisitFunctionDecl(FunctionDecl *D) { |