Visual Studio native visualizers for clang::TemplateSpecializationType
authorMike Spertus <mike@spertus.com>
Fri, 1 Apr 2016 03:31:43 +0000 (03:31 +0000)
committerMike Spertus <mike@spertus.com>
Fri, 1 Apr 2016 03:31:43 +0000 (03:31 +0000)
Displays a template specialization as, say, A<int, double>. Does not
yet handle UncommonTemplateNameStorage, QualifiedTemplateName, or
DependentTemplateName, but still more than worthwhile

llvm-svn: 265104

clang/utils/ClangVisualizers/clang.natvis

index b3fc6c7..6e4bdf3 100644 (file)
@@ -229,6 +229,7 @@ For later versions of Visual Studio, no setup is required-->
     </Expand>\r
   </Type>\r
   <Type Name="clang::TemplateArgument">\r
+    <DisplayString IncludeView="cpp">{*(clang::QualType *)&amp;TypeOrValue.V,view(cpp)}</DisplayString>\r
     <DisplayString>{(clang::TemplateArgument::ArgKind)TypeOrValue.Kind,en} template parameter: {*(clang::QualType *)&amp;TypeOrValue.V}</DisplayString>\r
     <Expand>\r
       <Item Name="QualType" Condition="Integer.Kind == clang::TemplateArgument::ArgKind::Type">*(clang::QualType *)&amp;TypeOrValue.V</Item>\r
@@ -269,8 +270,22 @@ For later versions of Visual Studio, no setup is required-->
   </Type>\r
 \r
   <Type Name="clang::TemplateSpecializationType">\r
-    <DisplayString Condition="(Template.Storage.Val.Val.Value &amp; 3) != 3 &amp;&amp; (Template.Storage.Val.Val.Value &amp; 2) != 2 &amp;&amp; (Template.Storage.Val.Val.Value &amp; 1) != 1">{(clang::TemplateDecl *)((Template.Storage.Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>\r
-    <DisplayString>{Template.Storage}</DisplayString>\r
+    <DisplayString IncludeView="arg0" Condition="NumArgs==0"></DisplayString>\r
+    <DisplayString IncludeView="arg0">{((clang::TemplateArgument *)(this+1))[0],view(cpp)}{*this,view(arg1)}</DisplayString>\r
+    <DisplayString IncludeView="arg1" Condition="NumArgs==1"></DisplayString>\r
+    <DisplayString IncludeView="arg1">, {((clang::TemplateArgument *)(this+1))[1],view(cpp)}{*this,view(arg2)}</DisplayString>\r
+    <DisplayString IncludeView="arg2" Condition="NumArgs==2"></DisplayString>\r
+    <DisplayString IncludeView="arg2">, {((clang::TemplateArgument *)(this+1))[2],view(cpp)}{*this,view(arg3)}</DisplayString>\r
+    <DisplayString Condition="(Template.Storage.Val.Val.Value &amp; 3) == 0">\r
+      {*((clang::TemplateDecl *)((Template.Storage.Val.Val.Value &gt;&gt; 2) &lt;&lt; 2))->TemplatedDecl,view(cpp)}&lt;{*this,view(arg0)}&gt;\r
+    </DisplayString>\r
+    <Expand>\r
+      <Item Name="Template">Template.Storage</Item>\r
+      <ArrayItems>\r
+        <Size>NumArgs</Size>\r
+        <ValuePointer>(clang::TemplateArgument *)(this+1)</ValuePointer>\r
+      </ArrayItems>\r
+    </Expand>\r
   </Type>\r
   <Type Name="clang::IdentifierInfo">\r
     <DisplayString Condition="Entry != 0">{((llvm::StringMapEntry&lt;clang::IdentifierInfo *&gt;*)Entry)+1,sb}</DisplayString>\r