Home | History | Annotate | Download | only in LLVMVisualizers
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!--
      3 Visual Studio Native Debugging Visualizers for LLVM
      4 
      5 For Visual Studio 2013 only, put this file into 
      6 "%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically.
      7 
      8 For later versions of Visual Studio, no setup is required.
      9 -->
     10 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
     11   <!-- VS2013 -->
     12   <Type Name="llvm::SmallVectorImpl&lt;*&gt;" Priority="MediumLow">
     13     <DisplayString Condition="Size == 0">empty</DisplayString>
     14     <DisplayString Condition="Size != 0">{{ size={Size} }}</DisplayString>
     15     <Expand>
     16       <Item Name="[size]">Size</Item>
     17       <Item Name="[capacity]">Capacity</Item>
     18       <ArrayItems>
     19         <Size>Size</Size>
     20         <ValuePointer>($T1*)BeginX</ValuePointer>
     21       </ArrayItems>
     22     </Expand>
     23   </Type>
     24   <!-- VS2015 and up -->
     25   <Type Name="llvm::SmallVectorImpl&lt;*&gt;">
     26     <DisplayString IncludeView ="elt0" Condition="Size == 0"></DisplayString>
     27     <DisplayString IncludeView ="elt0">{(($T1*)BeginX)[0]}{*this,view(elt1)}</DisplayString>
     28     <DisplayString IncludeView ="elt1" Condition="Size == 1"></DisplayString>
     29     <DisplayString IncludeView ="elt1">, {(($T1*)BeginX)[1]}{*this,view(elt2)}</DisplayString>
     30     <DisplayString IncludeView ="elt2" Condition="Size == 2"></DisplayString>
     31     <DisplayString IncludeView ="elt2">, {(($T1*)BeginX)[2]}{*this,view(elt3)}</DisplayString>
     32     <DisplayString IncludeView ="elt3" Condition="Size == 3"></DisplayString>
     33     <DisplayString IncludeView ="elt3">, {(($T1*)BeginX)[2]}{*this,view(elt4)}</DisplayString>
     34     <DisplayString IncludeView ="elt4" Condition="Size == 4"></DisplayString>
     35     <DisplayString IncludeView ="elt4">, /* {Size - 4} more*/ </DisplayString>
     36     <DisplayString Condition="Size == 0">empty</DisplayString>
     37     <DisplayString Condition="Size != 0">{{{*this,view(elt0)}}}</DisplayString>
     38     <Expand>
     39       <Item Name="[size]">Size</Item>
     40       <Item Name="[capacity]">Capacity</Item>
     41       <ArrayItems>
     42         <Size>Size</Size>
     43         <ValuePointer>($T1*)BeginX</ValuePointer>
     44       </ArrayItems>
     45     </Expand>
     46   </Type>
     47   <Type Name="llvm::ArrayRef&lt;*&gt;">
     48     <DisplayString Condition="Length == 0">empty</DisplayString>
     49     <DisplayString Condition="Length != 0">{{ size={Length} }}</DisplayString>
     50     <Expand>
     51       <Item Name="[size]">Length</Item>
     52       <ArrayItems>
     53         <Size>Length</Size>
     54         <ValuePointer>Data</ValuePointer>
     55       </ArrayItems>
     56     </Expand>
     57   </Type>
     58   <Type Name="llvm::SmallString&lt;*&gt;">
     59     <DisplayString>{(const char*)BeginX,[Size] na}</DisplayString>
     60     <StringView>(const char*)BeginX,[Size]</StringView>
     61     <Expand>
     62       <Item Name="[size]">Size</Item>
     63       <Item Name="[capacity]">Capacity</Item>
     64       <ArrayItems>
     65         <Size>Size</Size>
     66         <ValuePointer>(char*)BeginX</ValuePointer>
     67       </ArrayItems>
     68     </Expand>
     69   </Type>
     70 
     71   <Type Name="StringView">
     72     <DisplayString>{First,[Last - First]s}</DisplayString>
     73   </Type>
     74   
     75   <Type Name="llvm::StringRef">
     76     <DisplayString>{Data,[Length]s}</DisplayString>
     77     <StringView>Data,[Length]s</StringView>
     78     <Expand>
     79       <Item Name="[size]">Length</Item>
     80       <ArrayItems>
     81         <Size>Length</Size>
     82         <ValuePointer>Data</ValuePointer>
     83       </ArrayItems>
     84     </Expand>
     85   </Type>
     86 
     87   <Type Name="llvm::PointerIntPair&lt;*,*,*,*&gt;">
     88     <DisplayString>{IntMask}: {($T1)(Value &amp; PointerBitMask)} [{($T3)((Value &gt;&gt; IntShift) &amp; IntMask)}]</DisplayString>
     89     <Expand>
     90       <Item Name="[ptr]">($T1)(Value &amp; PointerBitMask)</Item>
     91       <Item Name="[int]">($T3)((Value &gt;&gt; IntShift) &amp; IntMask)</Item>
     92     </Expand>
     93   </Type>
     94 
     95   <Type Name="llvm::PointerUnion&lt;*,*&gt;">
     96     <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
     97     <DisplayString Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value &amp; Val.PointerBitMask)}</DisplayString>
     98     <Expand>
     99       <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) == 0">($T1)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
    100       <ExpandedItem Condition="((Val.Value &gt;&gt; Val.IntShift) &amp; Val.IntMask) != 0">($T2)(Val.Value &amp; Val.PointerBitMask)</ExpandedItem>
    101     </Expand>
    102   </Type>
    103 
    104   <Type Name="llvm::PointerUnion3&lt;*,*,*&gt;">
    105     <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>
    106     <DisplayString Condition="(Val.Val.Value &amp; 2) == 2">{"$T2", s8b}: {($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
    107     <DisplayString Condition="(Val.Val.Value &amp; 1) == 1">{"$T3", s8b}: {($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
    108     <Expand>
    109       <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>
    110       <ExpandedItem Condition="(Val.Val.Value &amp; 2) == 2">($T2)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
    111       <ExpandedItem Condition="(Val.Val.Value &amp; 1) == 1">($T3)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
    112     </Expand>
    113   </Type>
    114 
    115   <Type Name="llvm::PointerUnion4&lt;*,*,*,*&gt;">
    116     <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>
    117     <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>
    118     <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>
    119     <DisplayString Condition="(Val.Val.Value &amp; 3) == 3">{"$T4", s8b}: {($T4)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
    120     <Expand>
    121       <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>
    122       <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>
    123       <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>
    124       <ExpandedItem Condition="(Val.Val.Value &amp; 3) == 3">($T4)((Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)</ExpandedItem>
    125     </Expand>
    126   </Type>
    127 
    128   <Type Name="llvm::iplist&lt;*,*&gt;">
    129     <DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
    130     <DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
    131     <Expand>
    132       <LinkedListItems>
    133         <HeadPointer>Head</HeadPointer>
    134         <NextPointer>Next</NextPointer>
    135         <ValueNode>this</ValueNode>
    136       </LinkedListItems>
    137     </Expand>
    138   </Type>
    139 
    140   <Type Name="llvm::IntrusiveRefCntPtr&lt;*&gt;">
    141     <DisplayString Condition="Obj == 0">empty</DisplayString>
    142     <DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
    143     <DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;ref_cnt != 1)">RefPtr [{Obj-&gt;ref_cnt} refs] {*Obj}</DisplayString>
    144     <Expand>
    145       <Item Condition="Obj != 0" Name="[refs]">Obj-&gt;ref_cnt</Item>
    146       <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
    147     </Expand>
    148   </Type>
    149 
    150   <Type Name="llvm::SmallPtrSet&lt;*,*&gt;">
    151     <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
    152     <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
    153     <Expand>
    154       <Item Name="[size]">NumElements</Item>
    155       <Item Name="[capacity]">CurArraySize</Item>
    156       <ArrayItems>
    157         <Size>CurArraySize</Size>
    158         <ValuePointer>($T1*)CurArray</ValuePointer>
    159       </ArrayItems>
    160     </Expand>
    161   </Type>
    162 
    163   <Type Name="llvm::DenseMap&lt;*,*,*&gt;">
    164     <DisplayString Condition="NumEntries == 0">empty</DisplayString>
    165     <DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString>
    166     <Expand>
    167       <Item Name="[size]">NumEntries</Item>
    168       <Item Name="[buckets]">NumBuckets</Item>
    169       <ArrayItems>
    170         <Size>NumBuckets</Size>
    171         <ValuePointer>Buckets</ValuePointer>
    172       </ArrayItems>
    173     </Expand>
    174   </Type>
    175 
    176   <Type Name="llvm::StringMap&lt;*,*&gt;">
    177     <DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString>
    178     <Expand>
    179       <Item Name="[size]">NumItems</Item>
    180       <Item Name="[buckets]">NumBuckets</Item>
    181       <ArrayItems>
    182         <Size>NumBuckets</Size>
    183         <ValuePointer>(MapEntryTy**)TheTable</ValuePointer>
    184       </ArrayItems>
    185     </Expand>
    186   </Type>
    187 
    188   <Type Name="llvm::StringMapEntry&lt;*&gt;">
    189     <DisplayString Condition="StrLen == 0">empty</DisplayString>
    190     <DisplayString Condition="StrLen != 0">({this+1,s}, {second})</DisplayString>
    191     <Expand>
    192       <Item Name="[key]">this+1,s</Item>
    193       <Item Name="[value]" Condition="StrLen != 0">second</Item>
    194     </Expand>
    195   </Type>
    196 
    197   <Type Name="llvm::Triple">
    198     <DisplayString>{Data}</DisplayString>
    199   </Type>
    200   
    201   <Type Name="llvm::Optional&lt;*&gt;">
    202     <DisplayString Condition="!Storage.hasVal">None</DisplayString>
    203     <DisplayString Condition="Storage.hasVal">{*(($T1 *)(unsigned char *)Storage.storage.buffer)}</DisplayString>
    204     <Expand>
    205       <Item Name="[underlying]" Condition="Storage.hasVal">*(($T1 *)(unsigned char *)Storage.storage.buffer)</Item>
    206     </Expand>
    207   </Type>
    208 
    209   <Type Name="llvm::Expected&lt;*&gt;">
    210     <DisplayString Condition="HasError">Error</DisplayString>
    211     <DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString>
    212     <Expand>
    213       <Item Name="[value]" Condition="!HasError">*((storage_type *)TStorage.buffer)</Item>
    214       <Item Name="[error]" Condition="HasError">*((error_type *)ErrorStorage.buffer)</Item>
    215     </Expand>
    216   </Type>
    217 
    218 
    219   <!-- Since we're in MSVC, we can assume that the system is little endian.  Therefore
    220        the little and native cases just require a cast.  Handle this easy case first. Use
    221        a wildcard for the second template argument (the endianness), but we will use a
    222        specific value of 0 later on for the big endian to give it priority for being a
    223        better match.  -->
    224   <Type Name="llvm::support::detail::packed_endian_specific_integral&lt;*,*,1&gt;">
    225     <DisplayString>{{little endian value = {*(($T1*)(unsigned char *)Value.buffer)} }}</DisplayString>
    226     <Expand>
    227       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
    228       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
    229       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
    230       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
    231     </Expand>
    232   </Type>
    233   
    234   <!-- Now handle the hard case of big endian.  We need to do the swizzling here, but
    235        we need to specialize it based on the size of the value type. -->
    236   <Type Name="llvm::support::detail::packed_endian_specific_integral&lt;*,0,1&gt;">
    237     <DisplayString Condition="sizeof($T1)==1">{{ big endian value = {*(unsigned char *)Value.buffer} }}</DisplayString>
    238     <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) &lt;&lt; 8) 
    239                                                                     | ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString>
    240     <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) &lt;&lt; 24) 
    241                                                                     | (($T1)(*((unsigned char *)Value.buffer+1)) &lt;&lt; 16) 
    242                                                                     | (($T1)(*((unsigned char *)Value.buffer+2)) &lt;&lt; 8) 
    243                                                                     |  ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString>
    244     <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) &lt;&lt; 56) 
    245                                                                     | (($T1)(*((unsigned char *)Value.buffer+1)) &lt;&lt; 48) 
    246                                                                     | (($T1)(*((unsigned char *)Value.buffer+2)) &lt;&lt; 40) 
    247                                                                     | (($T1)(*((unsigned char *)Value.buffer+3)) &lt;&lt; 32) 
    248                                                                     | (($T1)(*((unsigned char *)Value.buffer+4)) &lt;&lt; 24) 
    249                                                                     | (($T1)(*((unsigned char *)Value.buffer+5)) &lt;&lt; 16) 
    250                                                                     | (($T1)(*((unsigned char *)Value.buffer+6)) &lt;&lt; 8) 
    251                                                                     |  ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString>
    252     <Expand>
    253       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
    254       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
    255       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
    256       <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
    257     </Expand>
    258   </Type>
    259 </AutoVisualizer>
    260