| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 
 | <?xml version="1.0" encoding="utf-8"?>
<!--
Visual Studio Native Debugging Visualizers for LLVM
For Visual Studio 2013 only, put this file into 
"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically.
For later versions of Visual Studio, no setup is required.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="llvm::SmallVectorImpl<*>">
    <DisplayString IncludeView ="elt0" Condition="Size == 0"></DisplayString>
    <DisplayString IncludeView ="elt0">{(($T1*)BeginX)[0]}{*this,view(elt1)}</DisplayString>
    <DisplayString IncludeView ="elt1" Condition="Size == 1"></DisplayString>
    <DisplayString IncludeView ="elt1">, {(($T1*)BeginX)[1]}{*this,view(elt2)}</DisplayString>
    <DisplayString IncludeView ="elt2" Condition="Size == 2"></DisplayString>
    <DisplayString IncludeView ="elt2">, {(($T1*)BeginX)[2]}{*this,view(elt3)}</DisplayString>
    <DisplayString IncludeView ="elt3" Condition="Size == 3"></DisplayString>
    <DisplayString IncludeView ="elt3">, {(($T1*)BeginX)[3]}{*this,view(elt4)}</DisplayString>
    <DisplayString IncludeView ="elt4" Condition="Size == 4"></DisplayString>
    <DisplayString IncludeView ="elt4">, /* {Size - 4} more*/ </DisplayString>
    <DisplayString Condition="Size == 0">empty</DisplayString>
    <DisplayString Condition="Size != 0">{{{*this,view(elt0)}}}</DisplayString>
    <DisplayString>Uninitialized</DisplayString>
    <Expand>
      <Item Name="[size]">Size</Item>
      <Item Name="[capacity]">Capacity</Item>
      <ArrayItems>
        <Size>Size</Size>
        <ValuePointer>($T1*)BeginX</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="llvm::APInt">
    <!-- For now, only handle up to 64-bit unsigned ints -->
    <DisplayString Condition="BitWidth <= 64">{U.VAL}</DisplayString>
    <DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString>
  </Type>
  <Type Name="llvm::ArrayRef<*>">
    <DisplayString Condition="Length == 0">empty</DisplayString>
    <DisplayString Condition="Length != 0">{{ size={Length} }}</DisplayString>
    <Expand>
      <Item Name="[size]">Length</Item>
      <ArrayItems>
        <Size>Length</Size>
        <ValuePointer>Data</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="llvm::SmallString<*>">
    <DisplayString>{(const char*)BeginX,[Size] na}</DisplayString>
    <StringView>(const char*)BeginX,[Size]</StringView>
    <Expand>
      <Item Name="[size]">Size</Item>
      <Item Name="[capacity]">Capacity</Item>
      <ArrayItems>
        <Size>Size</Size>
        <ValuePointer>(char*)BeginX</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="StringView">
    <DisplayString>{First,[Last - First]s}</DisplayString>
  </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>
  <!-- PointerIntPair. In addition to the regular view, it is possible to view just the pointer or just the int
    The same code is duplicated from the regular viewer to improve the performance of the common case -->
  <Type Name="llvm::PointerIntPair<*>">
    <DisplayString IncludeView="ptr">{($T1)(Value & $T5::PointerBitMask)}</DisplayString>
    <DisplayString IncludeView="int">{($T3)((Value >> $T5::IntShift) & $T5::IntMask)}</DisplayString>
    <DisplayString>{$T5::IntMask}: {($T1)(Value & $T5::PointerBitMask)} [{($T3)((Value >> $T5::IntShift) & $T5::IntMask)}]</DisplayString>
    <Expand>
      <Item Name="[ptr]">($T1)(Value & $T5::PointerBitMask)</Item>
      <Item Name="[int]">($T3)((Value >> $T5::IntShift) & $T5::IntMask)</Item>
    </Expand>
  </Type>
  <!-- PointerUnion types -->
  <Type Name="llvm::pointer_union_detail::PointerUnionMembers<*>">
    <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
      {($T4)(Val.Value & $T2::InfoTy::PointerBitMask)}
    </DisplayString>
    <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
      {($T5)(Val.Value & $T2::InfoTy::PointerBitMask)}
    </DisplayString>
    <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">
      {($T6)(Val.Value & $T2::InfoTy::PointerBitMask)}
    </DisplayString>
    <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">
      {($T7)(Val.Value & $T2::InfoTy::PointerBitMask)}
    </DisplayString>
    <DisplayString>Unexpected index in PointerUnion: {(Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask}</DisplayString>
    <Expand>
      <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">"$T4",s8b</Item>
      <Item Name="[Ptr]" Optional="true"  Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
        ($T4)(Val.Value & $T2::InfoTy::PointerBitMask)
      </Item>
      <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">"$T5",s8b</Item>
      <Item Name="[Ptr]" Optional="true"  Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
        ($T5)(Val.Value & $T2::InfoTy::PointerBitMask)
      </Item>
      <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">"$T6",s8b</Item>
      <Item Name="[Ptr]" Optional="true"  Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">
        ($T6)(Val.Value & $T2::InfoTy::PointerBitMask)
      </Item>
      <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">"$T6",s8b</Item>
      <Item Name="[Ptr]" Optional="true"  Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">
        ($T7)(Val.Value & $T2::InfoTy::PointerBitMask)
      </Item>
    </Expand>
  </Type>
 
  <Type Name="llvm::iplist<*,*>">
    <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<*>">
    <DisplayString Condition="Obj == 0">empty</DisplayString>
    <DisplayString Condition="(Obj != 0) && (Obj->RefCount == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
    <DisplayString Condition="(Obj != 0) && (Obj->RefCount != 1)">RefPtr [{Obj->RefCount} refs] {*Obj}</DisplayString>
    <Expand>
      <Item Condition="Obj != 0" Name="[refs]">Obj->RefCount</Item>
      <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
    </Expand>
  </Type>
  <Type Name="llvm::SmallPtrSet<*,*>">
    <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
    <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
    <Expand>
      <Item Name="[size]">NumNonEmpty</Item>
      <Item Name="[capacity]">CurArraySize</Item>
      <ArrayItems>
        <Size>NumNonEmpty</Size>
        <ValuePointer>($T1*)CurArray</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="llvm::DenseMap<*,*,*>">
    <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<*,*>">
    <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<*>">
    <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<*>">
    <DisplayString Condition="!Storage.hasVal">None</DisplayString>
    <DisplayString Condition="Storage.hasVal">{*(($T1 *)(unsigned char *)Storage.storage.buffer)}</DisplayString>
    <Expand>
      <Item Name="[underlying]" Condition="Storage.hasVal">*(($T1 *)(unsigned char *)Storage.storage.buffer)</Item>
    </Expand>
  </Type>
  <Type Name="llvm::Expected<*>">
    <DisplayString Condition="HasError">Error</DisplayString>
    <DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString>
    <Expand>
      <Item Name="[value]" Condition="!HasError">*((storage_type *)TStorage.buffer)</Item>
      <Item Name="[error]" Condition="HasError">*((error_type *)ErrorStorage.buffer)</Item>
    </Expand>
  </Type>
  <!-- Since we're in MSVC, we can assume that the system is little endian.  Therefore
       the little and native cases just require a cast.  Handle this easy case first. Use
       a wildcard for the second template argument (the endianness), but we will use a
       specific value of 0 later on for the big endian to give it priority for being a
       better match.  -->
  <Type Name="llvm::support::detail::packed_endian_specific_integral<*,*,1>">
    <DisplayString>{{little endian value = {*(($T1*)(unsigned char *)Value.buffer)} }}</DisplayString>
    <Expand>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
    </Expand>
  </Type>
  
  <!-- Now handle the hard case of big endian.  We need to do the swizzling here, but
       we need to specialize it based on the size of the value type. -->
  <Type Name="llvm::support::detail::packed_endian_specific_integral<*,0,1>">
    <DisplayString Condition="sizeof($T1)==1">{{ big endian value = {*(unsigned char *)Value.buffer} }}</DisplayString>
    <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 8) 
                                                                    | ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString>
    <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 24) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+1)) << 16) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+2)) << 8) 
                                                                    |  ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString>
    <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 56) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+1)) << 48) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+2)) << 40) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+3)) << 32) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+4)) << 24) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+5)) << 16) 
                                                                    | (($T1)(*((unsigned char *)Value.buffer+6)) << 8) 
                                                                    |  ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString>
    <Expand>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
      <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
    </Expand>
  </Type>
  <!-- llvm::Type has two fields, SubclassData and ContainedTys, the meaning of which change depending on the TypeID.
       This visualiser decodes those fields based on the value of ID.
  -->
  <Type Name="llvm::Type">
    <DisplayString>{ID}</DisplayString>
    <Expand>
      <Item Name="ID">ID</Item>
      <Item Name="NumBits" Condition="ID == llvm::Type::TypeID::IntegerTyID">SubclassData</Item>
      <Item Name="ReturnType" Condition="ID == llvm::Type::TypeID::FunctionTyID">*ContainedTys</Item>
      <Synthetic Name="Arguments" Condition="ID == llvm::Type::TypeID::FunctionTyID">
        <DisplayString>{NumContainedTys - 1}</DisplayString>
        <Expand>
        <ArrayItems>
          <Size>NumContainedTys - 1</Size>
          <ValuePointer>ContainedTys + 1</ValuePointer>
        </ArrayItems>
        </Expand>
      </Synthetic>
      <Item Name="IsVarArg" Condition="ID == llvm::Type::TypeID::FunctionTyID">SubclassData == 1</Item>
      <Item Name="HasBody" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData 	& llvm::StructType::SCDB_HasBody) != 0</Item>
      <Item Name="Packed" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData 	& llvm::StructType::SCDB_Packed) != 0</Item>
      <Item Name="IsLiteral" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData 	& llvm::StructType::SCDB_IsLiteral) != 0</Item>
      <Item Name="IsSized" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData 	& llvm::StructType::SCDB_IsSized) != 0</Item>
      <Synthetic Name="Members" Condition="ID == llvm::Type::TypeID::StructTyID">
        <DisplayString>{NumContainedTys}</DisplayString>
        <Expand>
          <ArrayItems>
            <Size>NumContainedTys</Size>
            <ValuePointer>ContainedTys</ValuePointer>
          </ArrayItems>
        </Expand>
      </Synthetic>
      <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ArrayTyID">*ContainedTys</Item>
      <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::ArrayTyID">((llvm::ArrayType*)this)->NumElements</Item>
      <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">*ContainedTys</Item>
      <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
      <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">*ContainedTys</Item>
      <Item Name="MinNumElements" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
      <Item Name="AddressSpace" Condition="ID == llvm::Type::TypeID::PointerTyID">SubclassData</Item>
      <Item Name="PointeeType" Condition="ID == llvm::Type::TypeID::PointerTyID">*ContainedTys</Item>
      <Item Name="Context">Context</Item>
    </Expand>
  </Type>
</AutoVisualizer>
 |