r361996 - [Index] Compute correct symbol kind for variable templates
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 10:49:30 PDT 2019
Author: ibiryukov
Date: Wed May 29 10:49:30 2019
New Revision: 361996
URL: http://llvm.org/viewvc/llvm-project?rev=361996&view=rev
Log:
[Index] Compute correct symbol kind for variable templates
Summary:
The index library itself seems to never pass variable templates as
input, however clangd does.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62579
Modified:
cfe/trunk/lib/Index/IndexSymbol.cpp
Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=361996&r1=361995&r2=361996&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Wed May 29 10:49:30 2019
@@ -96,6 +96,13 @@ SymbolInfo index::getSymbolInfo(const De
Info.Properties |= (SymbolPropertySet)SymbolProperty::ProtocolInterface;
}
+ if (auto *VT = dyn_cast<VarTemplateDecl>(D)) {
+ Info.Properties |= (SymbolPropertySet)SymbolProperty::Generic;
+ Info.Lang = SymbolLanguage::CXX;
+ // All other fields are filled from the templated decl.
+ D = VT->getTemplatedDecl();
+ }
+
if (const TagDecl *TD = dyn_cast<TagDecl>(D)) {
switch (TD->getTagKind()) {
case TTK_Struct:
@@ -333,6 +340,23 @@ SymbolInfo index::getSymbolInfo(const De
Info.Lang = SymbolLanguage::CXX;
}
break;
+ case Decl::ClassTemplatePartialSpecialization:
+ case Decl::ClassScopeFunctionSpecialization:
+ case Decl::ClassTemplateSpecialization:
+ case Decl::CXXRecord:
+ case Decl::Enum:
+ case Decl::Record:
+ llvm_unreachable("records handled before");
+ break;
+ case Decl::VarTemplateSpecialization:
+ case Decl::VarTemplatePartialSpecialization:
+ case Decl::ImplicitParam:
+ case Decl::ParmVar:
+ case Decl::Var:
+ case Decl::VarTemplate:
+ llvm_unreachable("variables handled before");
+ break;
+ // Other decls get the 'unknown' kind.
default:
break;
}
More information about the cfe-commits
mailing list