diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-05-12 16:32:26 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-05-12 16:32:26 +0000 |
commit | 1ab21368623ebeaebdc46344ff57890f767450ee (patch) | |
tree | b06783ad3f2935c2eb6d4707ca44aa70f010cf29 /lib/Index | |
parent | 1635c9f0a045570754fadc744ee7aa16fd482158 (diff) | |
download | clang-1ab21368623ebeaebdc46344ff57890f767450ee.tar.gz |
[index] Index template specialization arguments for function templats
Also ensure that class template specialization arguments are covered
rdar://31812032
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index')
-rw-r--r-- | lib/Index/IndexDecl.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 7de70a10b6..e55dea8e77 100644 --- a/lib/Index/IndexDecl.cpp +++ b/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(); |