r350487 - Have MSVC Visualizer for DeducedTemplateSpecializationType show both the original template and deduced specialization

Mike Spertus via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 5 20:58:48 PST 2019


Author: mps
Date: Sat Jan  5 20:58:48 2019
New Revision: 350487

URL: http://llvm.org/viewvc/llvm-project?rev=350487&view=rev
Log:
Have MSVC Visualizer for DeducedTemplateSpecializationType show both the original template and deduced specialization

Now appears in the Autos window something like

- MyType	DeducedTemplateSpecializationType  {struct Y<int>}
|- Template	template<typename T> struct Y;
|- Deduced As	struct Y<int>
|- isDeduced	true	bool
|- TypeClass	DeducedTemplateSpecialization (36)
|- Flags	No TypeBits set beyond TypeClass
|- Canonical	RecordType  {struct Y<int>}

Also changed QualType visualization to auto-expand the BaseType


Modified:
    cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=350487&r1=350486&r2=350487&view=diff
==============================================================================
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sat Jan  5 20:58:48 2019
@@ -40,16 +40,16 @@ For later versions of Visual Studio, no
     <DisplayString Condition="TypeBits.TC==clang::LocInfoType::LocInfo" IncludeView="poly">{*(clang::LocInfoType *)this}</DisplayString>
     <DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>
     <DisplayString IncludeView="poly">No visualizer yet for {(clang::Type::TypeClass)TypeBits.TC,en}Type</DisplayString> <!-- Not yet implemented Type subclass -->
-    <DisplayString IncludeView="Dependent" Condition="TypeBits.Dependent">Dependent</DisplayString>
+    <DisplayString IncludeView="Dependent" Condition="TypeBits.Dependent">Dependent{" ",sb}</DisplayString>
     <DisplayString IncludeView="Dependent"></DisplayString>
-    <DisplayString IncludeView="InstantiationDependent" Condition="TypeBits.InstantiationDependent">InstantiationDependent</DisplayString>
+    <DisplayString IncludeView="InstantiationDependent" Condition="TypeBits.InstantiationDependent">InstantiationDependent{" ",sb}</DisplayString>
     <DisplayString IncludeView="InstantiationDependent"></DisplayString>
-    <DisplayString IncludeView="VariablyModified" Condition="TypeBits.VariablyModified">VariablyModified</DisplayString>
+    <DisplayString IncludeView="VariablyModified" Condition="TypeBits.VariablyModified">VariablyModified{" ",sb}</DisplayString>
     <DisplayString IncludeView="VariablyModified"></DisplayString>
-    <DisplayString IncludeView="ContainsUnexpandedParameterPack" Condition="TypeBits.ContainsUnexpandedParameterPack">ContainsUnexpandedParameterPack</DisplayString>
+    <DisplayString IncludeView="ContainsUnexpandedParameterPack" Condition="TypeBits.ContainsUnexpandedParameterPack">ContainsUnexpandedParameterPack{" ",sb}</DisplayString>
     <DisplayString IncludeView="ContainsUnexpandedParameterPack"></DisplayString>
     <DisplayString IncludeView="Cache" Condition="TypeBits.CacheValid && TypeBits.CachedLocalOrUnnamed">CachedLinkage: {(clang::Linkage)TypeBits.CachedLinkage,en} CachedLocalOrUnnamed</DisplayString>
-    <DisplayString IncludeView="Cache" Condition="TypeBits.CacheValid && !TypeBits.CachedLocalOrUnnamed">CachedLinkage: {(clang::Linkage)TypeBits.CachedLinkage,en}</DisplayString>
+    <DisplayString IncludeView="Cache" Condition="TypeBits.CacheValid && !TypeBits.CachedLocalOrUnnamed">CachedLinkage: {(clang::Linkage)TypeBits.CachedLinkage,en}{" ",sb}</DisplayString>
     <DisplayString IncludeView="Cache"></DisplayString>
     <DisplayString IncludeView="FromAST" Condition="TypeBits.FromAST">FromAST</DisplayString>
     <DisplayString IncludeView="FromAST"></DisplayString>
@@ -162,13 +162,13 @@ For later versions of Visual Studio, no
   <Type Name="clang::TagDecl">
     <DisplayString IncludeView="implicit" Condition="Implicit">implicit{" ",sb}</DisplayString>
     <DisplayString IncludeView="implicit"></DisplayString>
-    <DisplayString IncludeView="modifiers">{*this,view(implicit)}</DisplayString>
+    <DisplayString IncludeView="modifiers">{*this,view(implicit)nd}</DisplayString>
     <DisplayString IncludeView="cpp">{*this,view(modifiers)}{Name,view(cpp)}</DisplayString>
-    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Struct">{*this,view(modifiers)}struct {Name,view(cpp)}</DisplayString>
-    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Interface">{*this,view(modifiers)}interface {Name,view(cpp)}</DisplayString>
-    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Union">{*this,view(modifiers)}union {Name,view(cpp)}</DisplayString>
-    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Class">{*this,view(modifiers)}class {Name,view(cpp)}</DisplayString>
-    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Enum">{*this,view(modifiers)}enum {Name,view(cpp)}</DisplayString>
+    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Struct">{*this,view(modifiers)nd}struct {Name,view(cpp)}</DisplayString>
+    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Interface">{*this,view(modifiers)nd}interface {Name,view(cpp)}</DisplayString>
+    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Union">{*this,view(modifiers)nd}union {Name,view(cpp)}</DisplayString>
+    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Class">{*this,view(modifiers)nd}class {Name,view(cpp)}</DisplayString>
+    <DisplayString Condition="TagDeclBits.TagDeclKind==clang::TagTypeKind::TTK_Enum">{*this,view(modifiers)nd}enum {Name,view(cpp)}</DisplayString>
     <Expand>
       <ExpandedItem>(clang::DeclContext *)this</ExpandedItem>
     </Expand>
@@ -227,6 +227,7 @@ For later versions of Visual Studio, no
     </Expand>
   </Type>
   <Type Name="clang::TemplateTypeParmType">
+    <DisplayString IncludeView="cpp" Condition="CanonicalType.Value.Value != this">{*TTPDecl}</DisplayString>
     <DisplayString Condition="CanonicalType.Value.Value != this">Non-canonical: {*TTPDecl}</DisplayString>
     <DisplayString>Canonical: {CanTTPTInfo}</DisplayString>
     <Expand>
@@ -267,7 +268,7 @@ For later versions of Visual Studio, no
     <DisplayString>{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType}{*this,view(fastQuals)}</DisplayString>
     <Expand>
       <Item Name="Fast Quals">*this,view(fastQuals)</Item>
-      <Item Name="BaseType">*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType</Item>
+      <ExpandedItem>*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType</ExpandedItem>
     </Expand>
   </Type>
   <Type Name="clang::LocInfoType">
@@ -419,9 +420,20 @@ For later versions of Visual Studio, no
     </Expand>
   </Type>
   <Type Name="clang::DeducedTemplateSpecializationType">
+    <DisplayString Condition="(CanonicalType.Value.Value != this) || TypeBits.Dependent">{CanonicalType,view(cpp)}</DisplayString>
     <DisplayString>{Template}</DisplayString>
     <Expand>
+      <Item Name="Template">Template</Item>
+      <Item Name="Deduced As" Condition="(CanonicalType.Value.Value != this) || TypeBits.Dependent">CanonicalType,view(cpp)</Item>
       <ExpandedItem>*(clang::DeducedType *)this</ExpandedItem>
+      <Item Name="Template">Template</Item>
+    </Expand>
+  </Type>
+  <Type Name="clang::ClassTemplateSpecializationDecl">
+    <DisplayString>{*(CXXRecordDecl *)this,nd}{*TemplateArgs}</DisplayString>
+    <Expand>
+      <ExpandedItem>(CXXRecordDecl *)this,nd</ExpandedItem>
+      <Item Name="TemplateArgs">TemplateArgs</Item>
     </Expand>
   </Type>
   <Type Name="clang::IdentifierInfo">
@@ -532,7 +544,6 @@ For later versions of Visual Studio, no
           </ArrayItems>
         </Expand>
       </Synthetic>
-      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
     </Expand>
   </Type>
   <Type Name="clang::OpaquePtr<*>">




More information about the cfe-commits mailing list