1<?xml version="1.0" encoding="utf-8"?>
2<!--
3Visual Studio 2012 Native Debugging Visualizers for LLVM
4
5Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers"
6or create a symbolic link so it updates automatically.
7-->
8<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
9
10  <Type Name="llvm::SmallVectorImpl&lt;*&gt;">
11    <DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) == 0">empty</DisplayString>
12    <DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) != 0">{{ size={($T1*)EndX - ($T1*)BeginX} }}</DisplayString>
13    <Expand>
14      <Item Name="[size]">($T1*)EndX - ($T1*)BeginX</Item>
15      <Item Name="[capacity]">($T1*)CapacityX - ($T1*)BeginX</Item>
16      <ArrayItems>
17        <Size>($T1*)EndX - ($T1*)BeginX</Size>
18        <ValuePointer>($T1*)BeginX</ValuePointer>
19      </ArrayItems>
20    </Expand>
21  </Type>
22
23  <Type Name="llvm::SmallString&lt;*&gt;">
24    <DisplayString>{BeginX,s}</DisplayString>
25    <StringView>BeginX,s</StringView>
26    <Expand>
27      <Item Name="[size]">(char*)EndX - (char*)BeginX</Item>
28      <Item Name="[capacity]">(char*)CapacityX - (char*)BeginX</Item>
29      <ArrayItems>
30        <Size>(char*)EndX - (char*)BeginX</Size>
31        <ValuePointer>(char*)BeginX</ValuePointer>
32      </ArrayItems>
33    </Expand>
34  </Type>
35
36  <Type Name="llvm::StringRef">
37    <DisplayString>{Data,[Length]s}</DisplayString>
38    <StringView>Data,[Length]s</StringView>
39    <Expand>
40      <Item Name="[size]">Length</Item>
41      <ArrayItems>
42        <Size>Length</Size>
43        <ValuePointer>Data</ValuePointer>
44      </ArrayItems>
45    </Expand>
46  </Type>
47
48  <Type Name="llvm::PointerIntPair&lt;*,*,*,*&gt;">
49    <DisplayString>{(void*)(Value &amp; PointerBitMask)} [{($T3)((Value &gt;&gt; IntShift) &amp; IntMask)}]</DisplayString>
50    <Expand>
51      <Item Name="[ptr]">($T1*)(Value &amp; PointerBitMask)</Item>
52      <Item Name="[int]">($T3)((Value &gt;&gt; IntShift) &amp; IntMask)</Item>
53    </Expand>
54  </Type>
55
56  <Type Name="llvm::PointerUnion&lt;*,*&gt;">
57    <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">{"$T1", s8b} {(void*)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
58    <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">{"$T2", s8b} {(void*)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
59    <Expand>
60      <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">($T1)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
61      <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">($T2)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
62    </Expand>
63  </Type>
64
65  <Type Name="llvm::PointerUnion3&lt;*,*,*&gt;">
66    <DisplayString Condition="(Val.Val.Value &amp; 2) != 2 &amp;&amp; (Val.Val.Value &amp; 1) != 1">{"$T1", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
67    <DisplayString Condition="(Val.Val.Value &amp; 2) == 2">{"$T2", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
68    <DisplayString Condition="(Val.Val.Value &amp; 1) == 1">{"$T3", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
69    <Expand>
70      <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>
71      <ExpandedItem Condition="(Val.Val.Value &amp; 2) == 2">($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
72      <ExpandedItem Condition="(Val.Val.Value &amp; 1) == 1">($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
73    </Expand>
74  </Type>
75
76  <Type Name="llvm::PointerUnion4&lt;*,*,*,*&gt;">
77    <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} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
78    <DisplayString Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 2) == 2">{"$T2", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
79    <DisplayString Condition="(Val.Val.Value &amp; 3) != 3 &amp;&amp; (Val.Val.Value &amp; 1) == 1">{"$T3", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
80    <DisplayString Condition="(Val.Val.Value &amp; 3) == 3">{"$T4", s8b} {(void*)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
81    <Expand>
82      <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>
83      <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>
84      <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>
85      <ExpandedItem Condition="(Val.Val.Value &amp; 3) == 3">($T4)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
86    </Expand>
87  </Type>
88
89  <Type Name="llvm::iplist&lt;*,*&gt;">
90    <DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
91    <DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
92    <Expand>
93      <LinkedListItems>
94        <HeadPointer>Head</HeadPointer>
95        <NextPointer>Next</NextPointer>
96        <ValueNode>this</ValueNode>
97      </LinkedListItems>
98    </Expand>
99  </Type>
100
101  <Type Name="llvm::IntrusiveRefCntPtr&lt;*&gt;">
102    <DisplayString Condition="Obj == 0">empty</DisplayString>
103    <DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
104    <DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt != 1)">RefPtr [{Obj-&gt;ref_cnt} refs] {*Obj}</DisplayString>
105    <Expand>
106      <Item Condition="Obj != 0" Name="[refs]">Obj-&gt;ref_cnt</Item>
107      <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
108    </Expand>
109  </Type>
110
111  <Type Name="llvm::SmallPtrSet&lt;*,*&gt;">
112    <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
113    <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
114    <Expand>
115      <Item Name="[size]">NumElements</Item>
116      <Item Name="[capacity]">CurArraySize</Item>
117      <ArrayItems>
118        <Size>CurArraySize</Size>
119        <ValuePointer>($T1*)CurArray</ValuePointer>
120      </ArrayItems>
121    </Expand>
122  </Type>
123
124  <Type Name="llvm::DenseMap&lt;*,*,*&gt;">
125    <DisplayString Condition="NumEntries == 0">empty</DisplayString>
126    <DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString>
127    <Expand>
128      <Item Name="[size]">NumEntries</Item>
129      <Item Name="[buckets]">NumBuckets</Item>
130      <ArrayItems>
131        <Size>NumBuckets</Size>
132        <ValuePointer>Buckets</ValuePointer>
133      </ArrayItems>
134    </Expand>
135  </Type>
136
137  <Type Name="llvm::StringMap&lt;*,*&gt;">
138    <DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString>
139    <Expand>
140      <Item Name="[size]">NumItems</Item>
141      <Item Name="[buckets]">NumBuckets</Item>
142      <ArrayItems>
143        <Size>NumBuckets</Size>
144        <ValuePointer>(MapEntryTy**)TheTable</ValuePointer>
145      </ArrayItems>
146    </Expand>
147  </Type>
148
149  <Type Name="llvm::StringMapEntry&lt;*&gt;">
150    <DisplayString Condition="StrLen == 0">empty</DisplayString>
151    <DisplayString Condition="StrLen != 0">({this+1,s}, {second})</DisplayString>
152    <Expand>
153      <Item Name="[key]">this+1,s</Item>
154      <Item Name="[value]" Condition="StrLen != 0">second</Item>
155    </Expand>
156  </Type>
157
158  <Type Name="llvm::Triple">
159    <DisplayString>{Data}</DisplayString>
160  </Type>
161
162  <Type Name="llvm::Optional&lt;*&gt;">
163    <DisplayString Condition="!hasVal">empty</DisplayString>
164    <DisplayString Condition="hasVal">{*(($T1 *)(unsigned char *)storage.buffer)}</DisplayString>
165    <Expand>
166      <Item Name="[underlying]" Condition="hasVal">*(($T1 *)(unsigned char *)storage.buffer)</Item>
167    </Expand>
168  </Type>
169</AutoVisualizer>
170