diff options
Diffstat (limited to 'lib/Index/IndexingContext.cpp')
-rw-r--r-- | lib/Index/IndexingContext.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Index/IndexingContext.cpp b/lib/Index/IndexingContext.cpp index bba6c8390b..e298560071 100644 --- a/lib/Index/IndexingContext.cpp +++ b/lib/Index/IndexingContext.cpp @@ -1,9 +1,8 @@ //===- IndexingContext.cpp - Indexing context data ------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -41,6 +40,14 @@ bool IndexingContext::shouldIndexImplicitInstantiation() const { return IndexOpts.IndexImplicitInstantiation; } +bool IndexingContext::shouldIndexParametersInDeclarations() const { + return IndexOpts.IndexParametersInDeclarations; +} + +bool IndexingContext::shouldIndexTemplateParameters() const { + return IndexOpts.IndexTemplateParameters; +} + bool IndexingContext::handleDecl(const Decl *D, SymbolRoleSet Roles, ArrayRef<SymbolRelation> Relations) { @@ -73,8 +80,11 @@ bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, if (!shouldIndexFunctionLocalSymbols() && isFunctionLocalSymbol(D)) return true; - if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D)) + if (!shouldIndexTemplateParameters() && + (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) || + isa<TemplateTemplateParmDecl>(D))) { return true; + } return handleDeclOccurrence(D, Loc, /*IsRef=*/true, Parent, Roles, Relations, RefE, RefD, DC); @@ -322,6 +332,7 @@ static bool shouldReportOccurrenceForSystemDeclOnlyMode( case SymbolRole::RelationCalledBy: case SymbolRole::RelationContainedBy: case SymbolRole::RelationSpecializationOf: + case SymbolRole::NameReference: return true; } llvm_unreachable("Unsupported SymbolRole value!"); @@ -400,10 +411,9 @@ bool IndexingContext::handleDeclOccurrence(const Decl *D, SourceLocation Loc, FinalRelations.reserve(Relations.size()+1); auto addRelation = [&](SymbolRelation Rel) { - auto It = std::find_if(FinalRelations.begin(), FinalRelations.end(), - [&](SymbolRelation Elem)->bool { - return Elem.RelatedSymbol == Rel.RelatedSymbol; - }); + auto It = llvm::find_if(FinalRelations, [&](SymbolRelation Elem) -> bool { + return Elem.RelatedSymbol == Rel.RelatedSymbol; + }); if (It != FinalRelations.end()) { It->Roles |= Rel.Roles; } else { |