summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexSymbol.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-11-07 21:20:15 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-11-07 21:20:15 +0000
commit9d8ab72a6931ef1d5810c815ce623666236b1427 (patch)
tree3dd13eb5d7db0e18c352dfcb04fe581c02e2bc53 /clang/lib/Index/IndexSymbol.cpp
parent3e5b61f7dad2e9165b2f0c169e3ea6da26f3c987 (diff)
downloadbcm5719-llvm-9d8ab72a6931ef1d5810c815ce623666236b1427.tar.gz
bcm5719-llvm-9d8ab72a6931ef1d5810c815ce623666236b1427.zip
[index] Handle properly C++14's template variables.
- Infer the right symbol kind. - Provide a templated USR, similar to how we handle class templates. rdar://28980398 llvm-svn: 286154
Diffstat (limited to 'clang/lib/Index/IndexSymbol.cpp')
-rw-r--r--clang/lib/Index/IndexSymbol.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp
index d98d7c07243..4126bb6a971 100644
--- a/clang/lib/Index/IndexSymbol.cpp
+++ b/clang/lib/Index/IndexSymbol.cpp
@@ -91,6 +91,25 @@ SymbolInfo index::getSymbolInfo(const Decl *D) {
Info.SubKinds |= (unsigned)SymbolSubKind::TemplateSpecialization;
}
+ } else if (auto *VD = dyn_cast<VarDecl>(D)) {
+ Info.Kind = SymbolKind::Variable;
+ if (isa<CXXRecordDecl>(D->getDeclContext())) {
+ Info.Kind = SymbolKind::StaticProperty;
+ Info.Lang = SymbolLanguage::CXX;
+ }
+ if (isa<VarTemplatePartialSpecializationDecl>(D)) {
+ Info.Lang = SymbolLanguage::CXX;
+ Info.SubKinds |= (unsigned)SymbolSubKind::Generic;
+ Info.SubKinds |= (unsigned)SymbolSubKind::TemplatePartialSpecialization;
+ } else if (isa<VarTemplateSpecializationDecl>(D)) {
+ Info.Lang = SymbolLanguage::CXX;
+ Info.SubKinds |= (unsigned)SymbolSubKind::Generic;
+ Info.SubKinds |= (unsigned)SymbolSubKind::TemplateSpecialization;
+ } else if (VD->getDescribedVarTemplate()) {
+ Info.Lang = SymbolLanguage::CXX;
+ Info.SubKinds |= (unsigned)SymbolSubKind::Generic;
+ }
+
} else {
switch (D->getKind()) {
case Decl::Import:
@@ -101,16 +120,6 @@ SymbolInfo index::getSymbolInfo(const Decl *D) {
case Decl::Function:
Info.Kind = SymbolKind::Function;
break;
- case Decl::ParmVar:
- Info.Kind = SymbolKind::Variable;
- break;
- case Decl::Var:
- Info.Kind = SymbolKind::Variable;
- if (isa<CXXRecordDecl>(D->getDeclContext())) {
- Info.Kind = SymbolKind::StaticProperty;
- Info.Lang = SymbolLanguage::CXX;
- }
- break;
case Decl::Field:
Info.Kind = SymbolKind::Field;
if (const CXXRecordDecl *
OpenPOWER on IntegriCloud