diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Index/IndexDecl.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Index/IndexingContext.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Index/IndexingContext.h | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index aa73d937df3..eb0b3d4a70e 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -88,12 +88,11 @@ public: /*isBase=*/false, isIBType); IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent); if (IndexCtx.shouldIndexFunctionLocalSymbols()) { - // Only index parameters in definitions, parameters in declarations are - // not useful. if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { auto *DC = Parm->getDeclContext(); if (auto *FD = dyn_cast<FunctionDecl>(DC)) { - if (FD->isThisDeclarationADefinition()) + if (IndexCtx.shouldIndexParametersInDeclarations() || + FD->isThisDeclarationADefinition()) IndexCtx.handleDecl(Parm); } else if (auto *MD = dyn_cast<ObjCMethodDecl>(DC)) { if (MD->isThisDeclarationADefinition()) @@ -102,7 +101,8 @@ public: IndexCtx.handleDecl(Parm); } } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - if (FD->isThisDeclarationADefinition()) { + if (IndexCtx.shouldIndexParametersInDeclarations() || + FD->isThisDeclarationADefinition()) { for (auto PI : FD->parameters()) { IndexCtx.handleDecl(PI); } diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp index 0bbd739d741..3d2d7d4ff02 100644 --- a/clang/lib/Index/IndexingContext.cpp +++ b/clang/lib/Index/IndexingContext.cpp @@ -40,6 +40,10 @@ bool IndexingContext::shouldIndexImplicitInstantiation() const { return IndexOpts.IndexImplicitInstantiation; } +bool IndexingContext::shouldIndexParametersInDeclarations() const { + return IndexOpts.IndexParametersInDeclarations; +} + bool IndexingContext::handleDecl(const Decl *D, SymbolRoleSet Roles, ArrayRef<SymbolRelation> Relations) { diff --git a/clang/lib/Index/IndexingContext.h b/clang/lib/Index/IndexingContext.h index 1de38513c61..7765fa73f82 100644 --- a/clang/lib/Index/IndexingContext.h +++ b/clang/lib/Index/IndexingContext.h @@ -61,6 +61,8 @@ public: bool shouldIndexImplicitInstantiation() const; + bool shouldIndexParametersInDeclarations() const; + static bool isTemplateImplicitInstantiation(const Decl *D); bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(), |