[PATCH] D62579: [Index] Compute correct symbol kind for variable templates

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 10:47:36 PDT 2019


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;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62579.201981.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190529/09380cf8/attachment.bin>


More information about the cfe-commits mailing list