]> granicus.if.org Git - llvm/commitdiff
Fix MSVC PointerUnion visualizer
authorMike Spertus <mike@spertus.com>
Wed, 2 Jan 2019 19:26:50 +0000 (19:26 +0000)
committerMike Spertus <mike@spertus.com>
Wed, 2 Jan 2019 19:26:50 +0000 (19:26 +0000)
Differential Revision: https://reviews.llvm.org/D56186

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

include/llvm/ADT/PointerIntPair.h
utils/LLVMVisualizers/llvm.natvis

index 884d05155bffa84ea68c584cdbe791435c0e6874..6d1b53a90ad23615131755a4df4b9037da7e2eb0 100644 (file)
@@ -42,6 +42,8 @@ template <typename PointerTy, unsigned IntBits, typename IntType = unsigned,
           typename PtrTraits = PointerLikeTypeTraits<PointerTy>,
           typename Info = PointerIntPairInfo<PointerTy, IntBits, PtrTraits>>
 class PointerIntPair {
+  // Used by MSVC visualizer and generally helpful for debugging/visualizing.
+  using InfoTy = Info;
   intptr_t Value = 0;
 
 public:
index bbded5dcc305bf6244d94f70a83258d3451609b2..56089648e1598dc7c8c0f2e423cbb5fd81af1a81 100644 (file)
@@ -35,6 +35,7 @@ For later versions of Visual Studio, no setup is required.
     <DisplayString IncludeView ="elt4">, /* {Size - 4} more*/ </DisplayString>\r
     <DisplayString Condition="Size == 0">empty</DisplayString>\r
     <DisplayString Condition="Size != 0">{{{*this,view(elt0)}}}</DisplayString>\r
+    <DisplayString>Uninitialized</DisplayString>\r
     <Expand>\r
       <Item Name="[size]">Size</Item>\r
       <Item Name="[capacity]">Capacity</Item>\r
@@ -93,11 +94,13 @@ For later versions of Visual Studio, no setup is required.
   </Type>\r
 \r
   <Type Name="llvm::PointerUnion&lt;*,*&gt;">\r
-    <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>\r
-    <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>\r
+    <DisplayString Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value &amp; ValTy::InfoTy::PointerBitMask)}</DisplayString>\r
+    <DisplayString Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value &amp; ValTy::InfoTy::PointerBitMask)}</DisplayString>\r
     <Expand>\r
-      <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">($T1)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>\r
-      <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">($T2)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>\r
+      <Item Name="[Holds]" Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) == 0">"$T1", s8b</Item>\r
+      <Item Name="[Ptr]" Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) == 0">($T1)(Val.Value &amp; ValTy::InfoTy::PointerBitMask)</Item>\r
+      <Item Name="[Holds]" Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) != 0">"$T2", s8b</Item>\r
+      <Item Name="[Ptr]" Condition="((Val.Value &gt;&gt; ValTy::InfoTy::IntShift) &amp; ValTy::InfoTy::IntMask) != 0">($T2)(Val.Value &amp; ValTy::InfoTy::PointerBitMask)</Item>\r
     </Expand>\r
   </Type>\r
 \r