]> granicus.if.org Git - clang/commitdiff
Improve MSVC visualizers for DeclSpec and TemplateName
authorMike Spertus <mike@spertus.com>
Mon, 29 Jul 2019 03:34:40 +0000 (03:34 +0000)
committerMike Spertus <mike@spertus.com>
Mon, 29 Jul 2019 03:34:40 +0000 (03:34 +0000)
DeclSpec now shows the TypeRep, ExprRep, or DeclRep as appropriate
TemplateName decodes and displays the StorageType
A few minor refinements to other types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367199 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ClangVisualizers/clang.natvis

index 8b2bf49b41bb974a6b3cc66a7ce4bf85864a524f..3b0f21af1ad6224bbba50556840ff0c6ea275a7e 100644 (file)
@@ -49,6 +49,7 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto" IncludeView="right">{(clang::FunctionProtoType *)this,view(right)na}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization" IncludeView="poly">{*(clang::TemplateSpecializationType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::DeducedTemplateSpecialization" IncludeView="poly">{*(clang::DeducedTemplateSpecializationType *)this}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::DeducedTemplateSpecialization" IncludeView="cpp">{*(clang::DeducedTemplateSpecializationType *)this,view(cpp)}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName" IncludeView="poly">{*(clang::InjectedClassNameType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::DependentName" IncludeView="poly">{*(clang::DependentNameType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::PackExpansion" IncludeView="poly">{*(clang::PackExpansionType *)this}</DisplayString>\r
@@ -203,6 +204,7 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString>{*this,view(TorC)} {*this,view(MaybeEllipses)}{Name,view(cpp)} {this,view(Initializer)na}</DisplayString> \r
   </Type>\r
   <Type Name="clang::TemplateDecl">\r
+    <DisplayString IncludeView="cpp">{*TemplatedDecl,view(cpp)}</DisplayString>\r
     <DisplayString>template{TemplateParams,na} {*TemplatedDecl};</DisplayString>\r
     <Expand>\r
       <Item Name="TemplateParams">TemplateParams,na</Item>\r
@@ -252,7 +254,57 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem Condition="Bits.Kind==UncommonTemplateNameStorage::SubstTemplateTemplateParmPack">(SubstTemplateTemplateParmPackStorage*)this</ExpandedItem>\r
     </Expand>\r
   </Type>\r
+  <!-- clang::TemplateName::StorageType -->\r
+  <Type Name="llvm::PointerUnion&lt;clang::TemplateDecl *, clang::UncommonTemplateNameStorage *,\r
+                          clang::QualifiedTemplateName *, clang::DependentTemplateName *&gt;">\r
+    <!-- Expand this out by hand to get cpp view -->\r
+    <DisplayString Condition="(Val.Value &amp;3) == 0" IncludeView="cpp">\r
+      {(clang::TemplateDecl *)(Val.Value &amp; ~3LL),view(cpp)na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 0">\r
+      {(clang::TemplateDecl *)(Val.Value &amp; ~3LL),na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 1" IncludeView="cpp">\r
+      {(clang::UncommonTemplateNameStorage *)(Val.Value &amp; ~3LL),view(cpp)na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 1">\r
+      {(clang::UncommonTemplateNameStorage *)(Val.Value &amp; ~3LL),na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 2" IncludeView="cpp">\r
+      {(clang::QualifiedTemplateName *)(Val.Value &amp; ~3LL),view(cpp)na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 2">\r
+      {(clang::QualifiedTemplateName *)(Val.Value &amp; ~3LL),na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 3" IncludeView="cpp">\r
+      {(clang::DependentTemplateName *)(Val.Value &amp; ~3LL),view(cpp)na}\r
+    </DisplayString>\r
+    <DisplayString Condition="(Val.Value &amp;3) == 3">\r
+      {(clang::DependentTemplateName *)(Val.Value &amp; ~3LL),na}\r
+    </DisplayString>\r
+    <Expand>\r
+      <Item Name="[Holds]" Condition="(Val.Value &amp;3) == 0">"TemplateDecl",s8b</Item>\r
+      <Item Name="[Ptr]" Optional="true"  Condition="(Val.Value &amp;3) == 0">\r
+        (clang::TemplateDecl *)(Val.Value &amp; ~3LL)\r
+      </Item>\r
+      <Item Name="[Holds]" Condition="(Val.Value &amp;3) == 1">"UncommonTemplateNameStorage",s8b</Item>\r
+      <Item Name="[Ptr]" Optional="true"  Condition="(Val.Value &amp;3) == 1">\r
+        (clang::UncommonTemplateNameStorage *)(Val.Value &amp; ~3LL)\r
+      </Item>\r
+      <Item Name="[Holds]" Condition="(Val.Value &amp;3) == 2">"QualifiedTemplateName",s8b</Item>\r
+      <Item Name="[Ptr]" Optional="true"  Condition="(Val.Value &amp;3) == 2">\r
+        (clang::QualifiedTemplateName *)(Val.Value &amp; ~3LL)\r
+      </Item>\r
+      <Item Name="[Holds]" Condition="(Val.Value &amp;3) == 3">"DependentTemplateName",s8b</Item>\r
+      <Item Name="[Ptr]" Optional="true"  Condition="(Val.Value &amp;3) == 3">\r
+        (clang::DependentTemplateName *)(Val.Value &amp; ~3LL)\r
+      </Item>\r
+      <Item Name="[Val]">Val</Item>\r
+\r
+    </Expand>\r
+  </Type>\r
   <Type Name="clang::TemplateName">\r
+    <DisplayString IncludeView="cpp">{Storage,view(cpp)na}</DisplayString>\r
     <DisplayString>{Storage,na}</DisplayString>\r
     <Expand>\r
       <ExpandedItem>Storage</ExpandedItem>\r
@@ -608,11 +660,12 @@ For later versions of Visual Studio, no setup is required-->
   </Type>\r
   <Type Name="clang::DeducedTemplateSpecializationType">\r
     <DisplayString Condition="(CanonicalType.Value.Value != this) || TypeBits.Dependent">{CanonicalType,view(cpp)}</DisplayString>\r
+    <DisplayString IncludeView="cpp">{Template,view(cpp)}</DisplayString>\r
     <DisplayString>{Template}</DisplayString>\r
     <Expand>\r
       <Item Name="Template">Template</Item>\r
       <Item Name="Deduced As" Condition="(CanonicalType.Value.Value != this) || TypeBits.Dependent">CanonicalType,view(cpp)</Item>\r
-      <ExpandedItem>*(clang::DeducedType *)this</ExpandedItem>\r
+      <ExpandedItem>(clang::DeducedType *)this</ExpandedItem>\r
       <Item Name="Template">Template</Item>\r
     </Expand>\r
   </Type>\r
@@ -711,7 +764,31 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString>{(clang::tok::TokenKind)Kind,en}</DisplayString>\r
   </Type>\r
   <Type Name="clang::DeclSpec">\r
-    <DisplayString>[{(clang::DeclSpec::SCS)StorageClassSpec}], [{(clang::TypeSpecifierType)TypeSpecType}]</DisplayString>\r
+    <DisplayString IncludeView="extra" Condition="TypeSpecType == TST_typename || TypeSpecType == TST_typeofType || TypeSpecType == TST_underlyingType || TypeSpecType == TST_atomic">\r
+      , [{TypeRep}]\r
+    </DisplayString>\r
+    <DisplayString IncludeView="extra" Condition="TypeSpecType == TST_typeofExpr || TypeSpecType == TST_decltype">\r
+      , [{ExprRep}]\r
+    </DisplayString>\r
+    <DisplayString IncludeView="extra" Condition="TypeSpecType == TST_enum || TypeSpecType == TST_struct || TypeSpecType == TST_interface || TypeSpecType == TST_union || TypeSpecType == TST_class">\r
+      , [{DeclRep}]\r
+    </DisplayString>\r
+    <DisplayString IncludeView="extra"></DisplayString>\r
+    <DisplayString>[{(clang::DeclSpec::SCS)StorageClassSpec,en}], [{(clang::TypeSpecifierType)TypeSpecType,en}]{this,view(extra)na}</DisplayString>\r
+    <Expand>\r
+      <Item Name="StorageClassSpec">(clang::DeclSpec::SCS)StorageClassSpec</Item>\r
+      <Item Name="TypeSpecType">(clang::TypeSpecifierType)TypeSpecType</Item>\r
+      <Item Name="TypeRep" Condition="TypeSpecType == TST_typename || TypeSpecType == TST_typeofType || TypeSpecType == TST_underlyingType || TypeSpecType == TST_atomic">\r
+        TypeRep\r
+      </Item>\r
+      <Item Name="ExprRep" Condition="TypeSpecType == TST_typeofExpr || TypeSpecType == TST_decltype">\r
+        ExprRep\r
+      </Item>\r
+      <Item Name="DeclRep" Condition="TypeSpecType == TST_enum || TypeSpecType == TST_struct || TypeSpecType == TST_interface || TypeSpecType == TST_union || TypeSpecType == TST_class">\r
+        DeclRep\r
+      </Item>\r
+\r
+    </Expand>\r
   </Type>\r
   <Type Name="clang::PragmaHandler">\r
     <DisplayString>{Name,s}</DisplayString>\r