]> granicus.if.org Git - clang/commitdiff
Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo
authorMike Spertus <mike@spertus.com>
Sat, 11 Jun 2016 20:15:19 +0000 (20:15 +0000)
committerMike Spertus <mike@spertus.com>
Sat, 11 Jun 2016 20:15:19 +0000 (20:15 +0000)
Created a visualizer for ActionResult that displayed the validity and the pointer,
but many of them initially displayed poorly. It turns out that the primary culprit
is that LocInfoType is often passed in an action result, but it is not the same
as other types. For example, LocInfoType is not in TypeNodes.def and clang::Type::TypeClass
does not have a LocInfoType enum. After adding a special visualizer for LocInfoType,
the display was more useful

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

utils/ClangVisualizers/clang.natvis

index 62cea41950ac7d0821e42f373e4cf7f2ce55db25..f5e13819e1b33b85d761280dfcaa1321a5788e60 100644 (file)
@@ -20,6 +20,7 @@ For later versions of Visual Studio, no setup is required-->
                    containing all the gory details.\r
            "cpp": Only occasionally used when we need to distinguish between an ordinary view and a C++-like view.\r
     -->\r
+    <DisplayString IncludeView="cmn" Condition="TypeBits.TC==clang::LocInfoType::LocInfo">LocInfoType</DisplayString>\r
     <DisplayString IncludeView="cmn">{(clang::Type::TypeClass)TypeBits.TC, en}Type</DisplayString>\r
     <!-- Dispatch to visualizers for the actual Type subclass -->\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Builtin" IncludeView="poly">{*(clang::BuiltinType *)this}</DisplayString>\r
@@ -34,6 +35,7 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto" IncludeView="poly">{*(clang::FunctionProtoType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization" IncludeView="poly">{*(clang::TemplateSpecializationType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName" IncludeView="poly">{*(clang::InjectedClassNameType *)this}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::LocInfoType::LocInfo" IncludeView="poly">{*(clang::LocInfoType *)this}</DisplayString>\r
     <DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>\r
     <DisplayString IncludeView="poly">{*this,view(cmn)}</DisplayString> <!-- Not yet implemented Type subclass -->\r
     <DisplayString>{*this,view(cmn)}  {{{*this,view(poly)}}}</DisplayString>\r
@@ -52,6 +54,7 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto">(clang::FunctionProtoType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization">(clang::TemplateSpecializationType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName">(clang::InjectedClassNameType *)this</ExpandedItem>\r
+      <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::LocInfoType::LocInfo">(clang::LocInfoType *)this</ExpandedItem>\r
     </Expand>\r
   </Type>\r
   <Type Name="clang::PointerType">\r
@@ -226,6 +229,16 @@ For later versions of Visual Studio, no setup is required-->
       <Item Name="BaseType">*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType</Item>\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::LocInfoType">\r
+    <DisplayString>{*DeclInfo}</DisplayString>\r
+    <Expand>\r
+      <Item Name="DeclInfo">DeclInfo</Item>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::TypeSourceInfo">\r
+    <DisplayString>{Ty}</DisplayString>\r
+  </Type>\r
   <Type Name="clang::TemplateArgumentLoc">\r
     <DisplayString>{Argument}</DisplayString>\r
     <Expand>\r
@@ -499,4 +512,30 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString Condition="ResultKind == clang::LookupResult::Ambiguous">{Ambiguity,en}: {Decls}</DisplayString>\r
     <DisplayString>{ResultKind,en}: {Decls}</DisplayString>\r
   </Type>\r
+  <Type Name="clang::ActionResult&lt;*&gt;" IncludeView="packedValidity">\r
+    <DisplayString Condition="PtrWithInvalid&amp;1">Invalid</DisplayString>\r
+    <DisplayString Condition="!(PtrWithInvalid&amp;1)">Valid</DisplayString>\r
+   </Type>\r
+  <Type Name="clang::ActionResult&lt;*&gt;" IncludeView="unpackedValidity">\r
+    <DisplayString Condition="Invalid">Invalid</DisplayString>\r
+    <DisplayString Condition="!Invalid">Valid</DisplayString>\r
+  </Type>\r
+  <Type Name="clang::ActionResult&lt;*&gt;" IncludeView="packed">\r
+    <DisplayString>{*this,view(packedValidity)}: {($T1 *)(PtrWithInvalid&amp;~1)}</DisplayString>\r
+    <Expand>\r
+      <Item Name="Invalid">(bool)(PtrWithInvalid&amp;1)</Item>\r
+      <Item Name="Val">($T1 *)(PtrWithInvalid&amp;~1)</Item>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::ActionResult&lt;*&gt;" IncludeView="unpacked">\r
+    <DisplayString>{*this,view(unpackedValidity)}: {Val}</DisplayString>\r
+  </Type>\r
+  <Type Name="clang::ActionResult&lt;*&gt;">\r
+    <DisplayString Condition="$T2">{*this,view(packed)}</DisplayString>\r
+    <DisplayString Condition="!$T2">{*this,view(unpacked)}</DisplayString>\r
+    <Expand>\r
+      <ExpandedItem Condition="$T2">*this,view(packed)</ExpandedItem>\r
+      <ExpandedItem Condition="!$T2">*this,view(unpacked)</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
 </AutoVisualizer>\r