summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexDecl.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-05-12 16:32:26 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-05-12 16:32:26 +0000
commitd43f75b54a246af10febebaa03169be9aa9d08ad (patch)
tree1fc88c98e60e5c6d57ac210d9300d5fff96fab3e /clang/lib/Index/IndexDecl.cpp
parent07c0dd765466ed7d0b10c6c185e7fd61d545acd1 (diff)
downloadbcm5719-llvm-d43f75b54a246af10febebaa03169be9aa9d08ad.tar.gz
bcm5719-llvm-d43f75b54a246af10febebaa03169be9aa9d08ad.zip
[index] Index template specialization arguments for function templats
Also ensure that class template specialization arguments are covered rdar://31812032 llvm-svn: 302918
Diffstat (limited to 'clang/lib/Index/IndexDecl.cpp')
-rw-r--r--clang/lib/Index/IndexDecl.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp
index 7de70a10b69..e55dea8e776 100644
--- a/clang/lib/Index/IndexDecl.cpp
+++ b/clang/lib/Index/IndexDecl.cpp
@@ -52,6 +52,22 @@ public:
return MD && !MD->isImplicit() && MD->isThisDeclarationADefinition();
}
+ void handleTemplateArgumentLoc(const TemplateArgumentLoc &TALoc,
+ const NamedDecl *Parent,
+ const DeclContext *DC) {
+ const TemplateArgumentLocInfo &LocInfo = TALoc.getLocInfo();
+ switch (TALoc.getArgument().getKind()) {
+ case TemplateArgument::Expression:
+ IndexCtx.indexBody(LocInfo.getAsExpr(), Parent, DC);
+ break;
+ case TemplateArgument::Type:
+ IndexCtx.indexTypeSourceInfo(LocInfo.getAsTypeSourceInfo(), Parent, DC);
+ break;
+ default:
+ break;
+ }
+ }
+
void handleDeclarator(const DeclaratorDecl *D,
const NamedDecl *Parent = nullptr,
bool isIBType = false) {
@@ -233,6 +249,12 @@ public:
Dtor->getParent(), Dtor->getDeclContext());
}
}
+ // Template specialization arguments.
+ if (const ASTTemplateArgumentListInfo *TemplateArgInfo =
+ D->getTemplateSpecializationArgsAsWritten()) {
+ for (const auto &Arg : TemplateArgInfo->arguments())
+ handleTemplateArgumentLoc(Arg, D, D->getLexicalDeclContext());
+ }
if (D->isThisDeclarationADefinition()) {
const Stmt *Body = D->getBody();
OpenPOWER on IntegriCloud