llvm/utils/llvm.natvis
Mike Spertus 67bf5dd452 Typesafe visualization of PointerIntPairs in Visual Studio
In the <DisplayString> of PointerIntPair , I cast the pointer to the actual type, so VS can leverage it while visualizing, not unlike the recent change to PointerUnion visualization.
In the expansion, the current code is casting to the incorrect type (wrong number of stars), so I fixed that as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263821 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 20:06:16 +00:00

170 lines
8.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Visual Studio 2012 Native Debugging Visualizers for LLVM
Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers"
or create a symbolic link so it updates automatically.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="llvm::SmallVectorImpl&lt;*&gt;">
<DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) == 0">empty</DisplayString>
<DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) != 0">{{ size={($T1*)EndX - ($T1*)BeginX} }}</DisplayString>
<Expand>
<Item Name="[size]">($T1*)EndX - ($T1*)BeginX</Item>
<Item Name="[capacity]">($T1*)CapacityX - ($T1*)BeginX</Item>
<ArrayItems>
<Size>($T1*)EndX - ($T1*)BeginX</Size>
<ValuePointer>($T1*)BeginX</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::SmallString&lt;*&gt;">
<DisplayString>{BeginX,s}</DisplayString>
<StringView>BeginX,s</StringView>
<Expand>
<Item Name="[size]">(char*)EndX - (char*)BeginX</Item>
<Item Name="[capacity]">(char*)CapacityX - (char*)BeginX</Item>
<ArrayItems>
<Size>(char*)EndX - (char*)BeginX</Size>
<ValuePointer>(char*)BeginX</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::StringRef">
<DisplayString>{Data,[Length]s}</DisplayString>
<StringView>Data,[Length]s</StringView>
<Expand>
<Item Name="[size]">Length</Item>
<ArrayItems>
<Size>Length</Size>
<ValuePointer>Data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::PointerIntPair&lt;*,*,*,*&gt;">
<DisplayString>{IntMask}: {($T1)(Value &amp; PointerBitMask)} [{($T3)((Value &gt;&gt; IntShift) &amp; IntMask)}]</DisplayString>
<Expand>
<Item Name="[ptr]">($T1)(Value &amp; PointerBitMask)</Item>
<Item Name="[int]">($T3)((Value &gt;&gt; IntShift) &amp; IntMask)</Item>
</Expand>
</Type>
<Type Name="llvm::PointerUnion&lt;*,*&gt;">
<DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
<DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
<Expand>
<ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">($T1)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
<ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">($T2)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
</Expand>
</Type>
<Type Name="llvm::PointerUnion3&lt;*,*,*&gt;">
<DisplayString Condition="(Val.Val.Value &amp; 2) != 2 &amp;&amp; (Val.Val.Value &amp; 1) != 1">{"$T1", s8b}: {($T1)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<DisplayString Condition="(Val.Val.Value &amp; 2) == 2">{"$T2", s8b}: {($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<DisplayString Condition="(Val.Val.Value &amp; 1) == 1">{"$T3", s8b}: {($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<Expand>
<ExpandedItem Condition="(Val.Val.Value &amp; 2) != 2 &amp;&amp; (Val.Val.Value &amp; 1) != 1">($T1)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
<ExpandedItem Condition="(Val.Val.Value &amp; 2) == 2">($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
<ExpandedItem Condition="(Val.Val.Value &amp; 1) == 1">($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
</Expand>
</Type>
<Type Name="llvm::PointerUnion4&lt;*,*,*,*&gt;">
<DisplayString Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 2) != 2 &amp;&amp; (Val.Val.Value &amp; 1) != 1">{"$T1", s8b}: {($T1)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<DisplayString Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 2) == 2">{"$T2", s8b}: {($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<DisplayString Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 1) == 1">{"$T3", s8b}: {($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<DisplayString Condition="(Val.Val.Value &amp; 3) == 3">{"$T4", s8b}: {($T4)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
<Expand>
<ExpandedItem Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 2) != 2 &amp;&amp; (Val.Val.Value &amp; 1) != 1">($T1)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
<ExpandedItem Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 2) == 2">($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
<ExpandedItem Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 1) == 1">($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
<ExpandedItem Condition="(Val.Val.Value &amp; 3) == 3">($T4)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
</Expand>
</Type>
<Type Name="llvm::iplist&lt;*,*&gt;">
<DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
<DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
<Expand>
<LinkedListItems>
<HeadPointer>Head</HeadPointer>
<NextPointer>Next</NextPointer>
<ValueNode>this</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="llvm::IntrusiveRefCntPtr&lt;*&gt;">
<DisplayString Condition="Obj == 0">empty</DisplayString>
<DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
<DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt != 1)">RefPtr [{Obj-&gt;ref_cnt} refs] {*Obj}</DisplayString>
<Expand>
<Item Condition="Obj != 0" Name="[refs]">Obj-&gt;ref_cnt</Item>
<ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
</Expand>
</Type>
<Type Name="llvm::SmallPtrSet&lt;*,*&gt;">
<DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
<DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
<Expand>
<Item Name="[size]">NumElements</Item>
<Item Name="[capacity]">CurArraySize</Item>
<ArrayItems>
<Size>CurArraySize</Size>
<ValuePointer>($T1*)CurArray</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::DenseMap&lt;*,*,*&gt;">
<DisplayString Condition="NumEntries == 0">empty</DisplayString>
<DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString>
<Expand>
<Item Name="[size]">NumEntries</Item>
<Item Name="[buckets]">NumBuckets</Item>
<ArrayItems>
<Size>NumBuckets</Size>
<ValuePointer>Buckets</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::StringMap&lt;*,*&gt;">
<DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString>
<Expand>
<Item Name="[size]">NumItems</Item>
<Item Name="[buckets]">NumBuckets</Item>
<ArrayItems>
<Size>NumBuckets</Size>
<ValuePointer>(MapEntryTy**)TheTable</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::StringMapEntry&lt;*&gt;">
<DisplayString Condition="StrLen == 0">empty</DisplayString>
<DisplayString Condition="StrLen != 0">({this+1,s}, {second})</DisplayString>
<Expand>
<Item Name="[key]">this+1,s</Item>
<Item Name="[value]" Condition="StrLen != 0">second</Item>
</Expand>
</Type>
<Type Name="llvm::Triple">
<DisplayString>{Data}</DisplayString>
</Type>
<Type Name="llvm::Optional&lt;*&gt;">
<DisplayString Condition="!hasVal">empty</DisplayString>
<DisplayString Condition="hasVal">{*(($T1 *)(unsigned char *)storage.buffer)}</DisplayString>
<Expand>
<Item Name="[underlying]" Condition="hasVal">*(($T1 *)(unsigned char *)storage.buffer)</Item>
</Expand>
</Type>
</AutoVisualizer>