summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexingContext.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-02-21 09:52:33 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-02-21 09:52:33 +0000
commitb780517ca5a1102187acbcedca8381542c809063 (patch)
tree9686472857d806f028fde14ffeef90f562d61678 /clang/lib/Index/IndexingContext.cpp
parentb672602f9ed9cf683e6094e615be6c65cca2f96e (diff)
downloadbcm5719-llvm-b780517ca5a1102187acbcedca8381542c809063.tar.gz
bcm5719-llvm-b780517ca5a1102187acbcedca8381542c809063.zip
[clang][Index] Enable indexing of Template Type Parameters behind a flag
Summary: clangd uses indexing api to provide references and it was not possible to perform symbol information for template parameters. This patch enables visiting of TemplateTypeParmTypeLocs. Reviewers: ilya-biryukov, akyrtzi Subscribers: javed.absar, kristof.beyls, ioeric, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58293 llvm-svn: 354560
Diffstat (limited to 'clang/lib/Index/IndexingContext.cpp')
-rw-r--r--clang/lib/Index/IndexingContext.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp
index 3d2d7d4ff02..d01dd50f3b5 100644
--- a/clang/lib/Index/IndexingContext.cpp
+++ b/clang/lib/Index/IndexingContext.cpp
@@ -44,6 +44,10 @@ 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) {
@@ -76,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);
OpenPOWER on IntegriCloud