From 9d8ab72a6931ef1d5810c815ce623666236b1427 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 7 Nov 2016 21:20:15 +0000 Subject: [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 --- clang/lib/Index/IndexSymbol.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'clang/lib/Index/IndexSymbol.cpp') 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(D)) { + Info.Kind = SymbolKind::Variable; + if (isa(D->getDeclContext())) { + Info.Kind = SymbolKind::StaticProperty; + Info.Lang = SymbolLanguage::CXX; + } + if (isa(D)) { + Info.Lang = SymbolLanguage::CXX; + Info.SubKinds |= (unsigned)SymbolSubKind::Generic; + Info.SubKinds |= (unsigned)SymbolSubKind::TemplatePartialSpecialization; + } else if (isa(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(D->getDeclContext())) { - Info.Kind = SymbolKind::StaticProperty; - Info.Lang = SymbolLanguage::CXX; - } - break; case Decl::Field: Info.Kind = SymbolKind::Field; if (const CXXRecordDecl * -- cgit v1.2.3