Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
| 2 | <!--
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 3 | Visual Studio Native Debugging Visualizers for LLVM
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 4 |
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 5 | Put this file into "%USERPROFILE%\Documents\Visual Studio 20xx\Visualizers"
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 6 | or create a symbolic link so it updates automatically.
|
| 7 | -->
|
| 8 | <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 9 |
|
Aaron Ballman | 9d21454 | 2015-09-29 17:32:36 +0000 | [diff] [blame] | 10 | <Type Name="clang::Type">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 11 | <!-- To visualize clang::Types, we need to look at TypeBits.TC to determine the actual
|
| 12 | type subclass and manually dispatch accordingly (Visual Studio can't identify the real type
|
| 13 | because clang::Type has no virtual members hence no RTTI).
|
| 14 |
|
| 15 | Views:
|
| 16 | "cmn": Visualization that is common to all clang::Type subclasses
|
| 17 | "poly": Visualization that is specific to the actual clang::Type subclass. The subtype-specific
|
| 18 | <DisplayString> is typically as C++-like as possible (like in dump()) with <Expand>
|
| 19 | containing all the gory details.
|
| 20 | "cpp": Only occasionally used when we need to distinguish between an ordinary view and a C++-like view.
|
| 21 | -->
|
| 22 | <DisplayString IncludeView="cmn">{(clang::Type::TypeClass)TypeBits.TC, en}Type</DisplayString>
|
| 23 | <!-- Dispatch to visualizers for the actual Type subclass -->
|
| 24 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Builtin" IncludeView="poly">{*(clang::BuiltinType *)this}</DisplayString>
|
| 25 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Pointer" IncludeView="poly">{*(clang::PointerType *)this}</DisplayString>
|
| 26 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::LValueReference" IncludeView="poly">{*(clang::LValueReferenceType *)this}</DisplayString>
|
| 27 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::RValueReference" IncludeView="poly">{*(clang::RValueReferenceType *)this}</DisplayString>
|
| 28 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Attributed" IncludeView="poly">{*(clang::AttributedType *)this}</DisplayString>
|
| 29 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm" IncludeView="poly">{*(clang::TemplateTypeParmType *)this}</DisplayString>
|
| 30 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm" IncludeView="poly">{*(clang::SubstTemplateTypeParmType *)this}</DisplayString>
|
| 31 | <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Record" IncludeView="poly">{*(clang::RecordType *)this}</DisplayString>
|
| 32 | <DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>
|
| 33 | <DisplayString IncludeView="poly">{*this,view(cmn)}"</DisplayString> <!-- Not yet implemented Type subclass -->
|
| 34 | <DisplayString>{*this,view(cmn)} {{{*this,view(poly)}}}</DisplayString>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 35 | <Expand>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 36 | <Item Name="TypeClass" IncludeView="cmn">(clang::Type::TypeClass)TypeBits.TC</Item>
|
| 37 | <Item Name="Flags" IncludeView="cmn">TypeBits</Item>
|
| 38 | <Item Name="Canonical" IncludeView="cmn">CanonicalType</Item>
|
| 39 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Builtin">*(clang::BuiltinType *)this</ExpandedItem>
|
| 40 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Pointer">*(clang::PointerType *)this</ExpandedItem>
|
| 41 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::LValueReference">*(clang::LValueReferenceType *)this</ExpandedItem>
|
| 42 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::RValueReference">*(clang::RValueReferenceType *)this</ExpandedItem>
|
| 43 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Attributed">*(clang::AttributedType *)this</ExpandedItem>
|
| 44 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm">(clang::TemplateTypeParmType *)this</ExpandedItem>
|
| 45 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm">(clang::SubstTemplateTypeParmType *)this</ExpandedItem>
|
| 46 | <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Record">(clang::RecordType *)this</ExpandedItem>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 47 | </Expand>
|
| 48 | </Type>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 49 | <Type Name="clang::PointerType">
|
| 50 | <DisplayString>{PointeeType, view(poly)} *</DisplayString>
|
| 51 | <Expand>
|
| 52 | <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
|
| 53 | <Item Name="PointeeType">PointeeType</Item>
|
| 54 | </Expand>
|
| 55 | </Type>
|
| 56 | <!-- We visualize all inner types for clang reference types. So a rvalue reference to an lvalue reference
|
| 57 | to an int would visual as int & && This is a little different than GetPointeeType(),
|
| 58 | but more clearly displays the data structure and seems natural -->
|
| 59 | <Type Name="clang::LValueReferenceType">
|
| 60 | <DisplayString>{((clang::ReferenceType *)this)->PointeeType,view(cpp)} &</DisplayString>
|
| 61 | <Expand>
|
| 62 | <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
|
| 63 | <Item Name="PointeeType">PointeeType</Item>
|
| 64 | </Expand>
|
| 65 | </Type>
|
| 66 | <Type Name="clang::RValueReferenceType">
|
| 67 | <DisplayString>{((clang::ReferenceType *)this)->PointeeType,view(cpp)} &&</DisplayString>
|
| 68 | <Expand>
|
| 69 | <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
|
| 70 | <Item Name="PointeeType">PointeeType</Item>
|
| 71 | </Expand>
|
| 72 | </Type>
|
| 73 | <Type Name="clang::AttributedType">
|
| 74 | <DisplayString>{ModifiedType} Attribute={(clang::AttributedType::Kind)AttributedTypeBits.AttrKind}</DisplayString>
|
| 75 | </Type>
|
| 76 | <Type Name="clang::NamedDecl" >
|
| 77 | <DisplayString IncludeView="cpp">{Name,view(cpp)}</DisplayString>
|
| 78 | <DisplayString>{Name}</DisplayString>
|
| 79 | </Type>
|
| 80 | <Type Name="clang::TagDecl">
|
| 81 | <DisplayString Condition="TagDeclKind==clang::TagTypeKind::TTK_Struct">struct {Name,view(cpp)}</DisplayString>
|
| 82 | <DisplayString Condition="TagDeclKind==clang::TagTypeKind::TTK_Interface">interface {Name,view(cpp)}</DisplayString>
|
| 83 | <DisplayString Condition="TagDeclKind==clang::TagTypeKind::TTK_Union">union {Name,view(cpp)}</DisplayString>
|
| 84 | <DisplayString Condition="TagDeclKind==clang::TagTypeKind::TTK_Class">class {Name,view(cpp)}</DisplayString>
|
| 85 | <DisplayString Condition="TagDeclKind==clang::TagTypeKind::TTK_Enum">enum {Name,view(cpp)}</DisplayString>
|
| 86 | </Type>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 87 | <Type Name="clang::TagType">
|
| 88 | <DisplayString>{*decl}</DisplayString>
|
| 89 | <Expand>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 90 | <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 91 | <Item Name="decl">decl</Item>
|
| 92 | </Expand>
|
| 93 | </Type>
|
| 94 | <Type Name="clang::RecordType">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 95 | <DisplayString>{*(clang::TagType *)this}</DisplayString>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 96 | <Expand>
|
| 97 | <Item Name="TagType">*(clang::TagType *)this</Item>
|
| 98 | </Expand>
|
| 99 | </Type>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 100 |
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 101 | <Type Name="clang::SubstTemplateTypeParmType">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 102 | <DisplayString>{*Replaced,view(cpp)} <= {CanonicalType,view(cpp)}</DisplayString>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 103 | <Expand>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 104 | <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 105 | <Item Name="Replaced">*Replaced</Item>
|
| 106 | </Expand>
|
| 107 | </Type>
|
| 108 | <Type Name="clang::TemplateTypeParmType">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 109 | <DisplayString>typename {*TTPDecl,view(cpp)}</DisplayString>
|
Aaron Ballman | 9d21454 | 2015-09-29 17:32:36 +0000 | [diff] [blame] | 110 | </Type>
|
| 111 | <Type Name="clang::QualType">
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 112 | <!-- TODO: Qualifiers. Also, when VS2013 support is deprecated, change 4 to clang::TypeAlignmentInBits (not properly recognized by VS2013) -->
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 113 | <DisplayString IncludeView="poly">{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(poly)}</DisplayString>
|
| 114 | <DisplayString IncludeView="cpp">{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType,view(cpp)}</DisplayString>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 115 | <DisplayString>{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType}</DisplayString>
|
| 116 | <Expand>
|
| 117 | <Item Name="BaseType">*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType</Item>
|
| 118 | </Expand>
|
| 119 | </Type>
|
| 120 | <Type Name="clang::TemplateArgumentLoc">
|
| 121 | <DisplayString>{Argument}</DisplayString>
|
| 122 | <Expand>
|
| 123 | <ExpandedItem>Argument</ExpandedItem>
|
| 124 | </Expand>
|
| 125 | </Type>
|
| 126 | <Type Name="clang::TemplateArgument">
|
| 127 | <DisplayString>{(clang::TemplateArgument::ArgKind)TypeOrValue.Kind,en} template parameter: {*(clang::QualType *)&TypeOrValue.V}</DisplayString>
|
| 128 | <Expand>
|
| 129 | <Item Name="QualType" Condition="Integer.Kind == clang::TemplateArgument::ArgKind::Type">*(clang::QualType *)&TypeOrValue.V</Item>
|
| 130 | <!-- TODO: Other kinds-->
|
| 131 | </Expand>
|
| 132 | </Type>
|
| 133 | <Type Name="clang::BuiltinType">
|
| 134 | <DisplayString>{(clang::BuiltinType::Kind)BuiltinTypeBits.Kind, en}</DisplayString>
|
| 135 | <Expand>
|
| 136 | <Item Name="Kind">(clang::BuiltinType::Kind)BuiltinTypeBits.Kind</Item>
|
| 137 | </Expand>
|
| 138 | </Type>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 139 |
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 140 | <Type Name="clang::TemplateSpecializationType">
|
| 141 | <DisplayString Condition="(Template.Storage.Val.Val.Value & 3) != 3 && (Template.Storage.Val.Val.Value & 2) != 2 && (Template.Storage.Val.Val.Value & 1) != 1">{(clang::TemplateDecl *)((Template.Storage.Val.Val.Value >> 2) << 2)}</DisplayString>
|
| 142 | <DisplayString>{Template.Storage}</DisplayString>
|
Aaron Ballman | 9d21454 | 2015-09-29 17:32:36 +0000 | [diff] [blame] | 143 | </Type>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 144 | <Type Name="clang::IdentifierInfo">
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 145 | <DisplayString Condition="Entry != 0">{((llvm::StringMapEntry<clang::IdentifierInfo *>*)Entry)+1,sb}</DisplayString>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 146 | <Expand>
|
| 147 | <Item Condition="Entry != 0" Name="[Identifier]">((llvm::StringMapEntry<clang::IdentifierInfo *>*)Entry)+1,s</Item>
|
| 148 | <Item Name="Token Kind">(clang::tok::TokenKind)TokenID</Item>
|
| 149 | </Expand>
|
| 150 | </Type>
|
| 151 | <Type Name="clang::DeclarationName">
|
| 152 | <DisplayString Condition="Ptr == 0">Empty</DisplayString>
|
Mike Spertus | 01b14bf | 2016-03-16 14:27:50 +0000 | [diff] [blame^] | 153 | <DisplayString Condition="(Ptr & PtrMask) == StoredIdentifier" IncludeView="cpp">{*(clang::IdentifierInfo *)(Ptr & ~PtrMask)}</DisplayString>
|
Zachary Turner | dfa871b | 2014-06-26 16:26:42 +0000 | [diff] [blame] | 154 | <DisplayString Condition="(Ptr & PtrMask) == StoredIdentifier">{{Identifier ({*(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
|
| 155 | <DisplayString Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector">{{ObjC Zero Arg Selector (*{(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
|
| 156 | <DisplayString Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector">{{ObjC One Arg Selector (*{(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 157 | <DisplayString Condition="(Ptr & PtrMask) == StoredDeclarationNameExtra">{{Extra ({(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr & ~PtrMask))->ExtraKindOrNumArgs})}}</DisplayString>
|
| 158 | <Expand>
|
Zachary Turner | dfa871b | 2014-06-26 16:26:42 +0000 | [diff] [blame] | 159 | <Item Condition="(Ptr & PtrMask) == StoredIdentifier" Name="[Identifier]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
|
| 160 | <Item Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector" Name="[ObjC Zero Arg Selector]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
|
| 161 | <Item Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector" Name="[ObjC One Arg Selector]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 162 | <Item Condition="(Ptr & PtrMask) == StoredDeclarationNameExtra" Name="[Extra]">(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr & ~PtrMask))->ExtraKindOrNumArgs</Item>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 163 | </Expand>
|
| 164 | </Type>
|
| 165 | <Type Name="clang::Token">
|
| 166 | <DisplayString Condition="Kind != clang::tok::identifier">{(clang::tok::TokenKind)Kind,en}</DisplayString>
|
| 167 | <DisplayString Condition="Kind == clang::tok::identifier">{{Identifier ({*(clang::IdentifierInfo *)(PtrData)})}}</DisplayString>
|
| 168 | </Type>
|
| 169 | <Type Name="clang::DeclSpec">
|
| 170 | <DisplayString>[{(clang::DeclSpec::SCS)StorageClassSpec}], [{(clang::TypeSpecifierType)TypeSpecType}]</DisplayString>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 171 | </Type>
|
| 172 | <Type Name="clang::PragmaHandler">
|
| 173 | <DisplayString>{Name,s}</DisplayString>
|
| 174 | </Type>
|
| 175 | <Type Name="clang::FileEntry">
|
| 176 | <DisplayString>{Name,s}</DisplayString>
|
| 177 | </Type>
|
| 178 | <Type Name="clang::DirectoryEntry">
|
| 179 | <DisplayString>{Name,s}</DisplayString>
|
| 180 | </Type>
|
Zachary Turner | dfa871b | 2014-06-26 16:26:42 +0000 | [diff] [blame] | 181 | <Type Name="clang::VarDecl::VarDeclBitfields">
|
| 182 | <Expand>
|
| 183 | <Item Name="StorageClass">(clang::StorageClass)SClass</Item>
|
| 184 | <Item Name="ThreadStorageClass">(clang::ThreadStorageClassSpecifier)TSCSpec</Item>
|
| 185 | <Item Name="InitStyle">(clang::VarDecl::InitializationStyle)InitStyle</Item>
|
| 186 | </Expand>
|
| 187 | </Type>
|
| 188 | <Type Name="clang::VarDecl">
|
| 189 | <DisplayString>{Name}</DisplayString>
|
| 190 | <Expand>
|
| 191 | <ExpandedItem>*(DeclaratorDecl*)this,nd</ExpandedItem>
|
| 192 | <Item Name="VarDeclBits">VarDeclBits</Item>
|
| 193 | <Item Name="ParmVarDeclBits">ParmVarDeclBits</Item>
|
| 194 | </Expand>
|
| 195 | </Type>
|
Mike Spertus | 288daa5 | 2016-03-08 16:14:23 +0000 | [diff] [blame] | 196 | <Type Name="clang::OpaquePtr<*>">
|
| 197 | <DisplayString>{($T1 *)Ptr</DisplayString>
|
| 198 | <Expand>
|
| 199 | <ExpandedItem>($T1 *)Ptr</ExpandedItem>
|
| 200 | </Expand>
|
| 201 | </Type>
|
Aaron Ballman | 83f197b | 2014-01-24 19:46:45 +0000 | [diff] [blame] | 202 | </AutoVisualizer>
|