This revision was automatically updated to reflect the committed changes. Closed by commit rC361996: [Index] Compute correct symbol kind for variable templates (authored by ibiryukov, committed by ).
Changed prior to commit: https://reviews.llvm.org/D62579?vs=201980&id=201981#toc Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62579/new/ https://reviews.llvm.org/D62579 Files: lib/Index/IndexSymbol.cpp Index: lib/Index/IndexSymbol.cpp =================================================================== --- lib/Index/IndexSymbol.cpp +++ lib/Index/IndexSymbol.cpp @@ -96,6 +96,13 @@ 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 @@ 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; }
Index: lib/Index/IndexSymbol.cpp =================================================================== --- lib/Index/IndexSymbol.cpp +++ lib/Index/IndexSymbol.cpp @@ -96,6 +96,13 @@ 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 @@ 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; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits