blob: ef20a211ebc0393053420503a1a6a30aea46f42d [file] [log] [blame]
Aaron Ballman83f197b2014-01-24 19:46:45 +00001<?xml version="1.0" encoding="utf-8"?>
2<!--
Mike Spertus288daa52016-03-08 16:14:23 +00003Visual Studio Native Debugging Visualizers for LLVM
Aaron Ballman83f197b2014-01-24 19:46:45 +00004
Mike Spertus288daa52016-03-08 16:14:23 +00005Put this file into "%USERPROFILE%\Documents\Visual Studio 20xx\Visualizers"
Aaron Ballman83f197b2014-01-24 19:46:45 +00006or create a symbolic link so it updates automatically.
7-->
8<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
Mike Spertus01b14bf2016-03-16 14:27:50 +00009
Aaron Ballman9d214542015-09-29 17:32:36 +000010 <Type Name="clang::Type">
Mike Spertus01b14bf2016-03-16 14:27:50 +000011 <!-- 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 Spertus288daa52016-03-08 16:14:23 +000035 <Expand>
Mike Spertus01b14bf2016-03-16 14:27:50 +000036 <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 Spertus288daa52016-03-08 16:14:23 +000047 </Expand>
48 </Type>
Mike Spertus01b14bf2016-03-16 14:27:50 +000049 <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 &amp; &amp;&amp; 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)-&gt;PointeeType,view(cpp)} &amp;</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)-&gt;PointeeType,view(cpp)} &amp;&amp;</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 Spertus288daa52016-03-08 16:14:23 +000087 <Type Name="clang::TagType">
88 <DisplayString>{*decl}</DisplayString>
89 <Expand>
Mike Spertus01b14bf2016-03-16 14:27:50 +000090 <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
Mike Spertus288daa52016-03-08 16:14:23 +000091 <Item Name="decl">decl</Item>
92 </Expand>
93 </Type>
94 <Type Name="clang::RecordType">
Mike Spertus01b14bf2016-03-16 14:27:50 +000095 <DisplayString>{*(clang::TagType *)this}</DisplayString>
Mike Spertus288daa52016-03-08 16:14:23 +000096 <Expand>
97 <Item Name="TagType">*(clang::TagType *)this</Item>
98 </Expand>
99 </Type>
Mike Spertus01b14bf2016-03-16 14:27:50 +0000100
Mike Spertus288daa52016-03-08 16:14:23 +0000101 <Type Name="clang::SubstTemplateTypeParmType">
Mike Spertus01b14bf2016-03-16 14:27:50 +0000102 <DisplayString>{*Replaced,view(cpp)} &lt;= {CanonicalType,view(cpp)}</DisplayString>
Mike Spertus288daa52016-03-08 16:14:23 +0000103 <Expand>
Mike Spertus01b14bf2016-03-16 14:27:50 +0000104 <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
Mike Spertus288daa52016-03-08 16:14:23 +0000105 <Item Name="Replaced">*Replaced</Item>
106 </Expand>
107 </Type>
108 <Type Name="clang::TemplateTypeParmType">
Mike Spertus01b14bf2016-03-16 14:27:50 +0000109 <DisplayString>typename {*TTPDecl,view(cpp)}</DisplayString>
Aaron Ballman9d214542015-09-29 17:32:36 +0000110 </Type>
111 <Type Name="clang::QualType">
Mike Spertus288daa52016-03-08 16:14:23 +0000112 <!-- TODO: Qualifiers. Also, when VS2013 support is deprecated, change 4 to clang::TypeAlignmentInBits (not properly recognized by VS2013) -->
Mike Spertus01b14bf2016-03-16 14:27:50 +0000113 <DisplayString IncludeView="poly">{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType,view(poly)}</DisplayString>
114 <DisplayString IncludeView="cpp">{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType,view(cpp)}</DisplayString>
Mike Spertus288daa52016-03-08 16:14:23 +0000115 <DisplayString>{*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType}</DisplayString>
116 <Expand>
117 <Item Name="BaseType">*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;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 *)&amp;TypeOrValue.V}</DisplayString>
128 <Expand>
129 <Item Name="QualType" Condition="Integer.Kind == clang::TemplateArgument::ArgKind::Type">*(clang::QualType *)&amp;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 Spertus01b14bf2016-03-16 14:27:50 +0000139
Mike Spertus288daa52016-03-08 16:14:23 +0000140 <Type Name="clang::TemplateSpecializationType">
141 <DisplayString Condition="(Template.Storage.Val.Val.Value &amp; 3) != 3 &amp;&amp; (Template.Storage.Val.Val.Value &amp; 2) != 2 &amp;&amp; (Template.Storage.Val.Val.Value &amp; 1) != 1">{(clang::TemplateDecl *)((Template.Storage.Val.Val.Value &gt;&gt; 2) &lt;&lt; 2)}</DisplayString>
142 <DisplayString>{Template.Storage}</DisplayString>
Aaron Ballman9d214542015-09-29 17:32:36 +0000143 </Type>
Aaron Ballman83f197b2014-01-24 19:46:45 +0000144 <Type Name="clang::IdentifierInfo">
Mike Spertus01b14bf2016-03-16 14:27:50 +0000145 <DisplayString Condition="Entry != 0">{((llvm::StringMapEntry&lt;clang::IdentifierInfo *&gt;*)Entry)+1,sb}</DisplayString>
Aaron Ballman83f197b2014-01-24 19:46:45 +0000146 <Expand>
147 <Item Condition="Entry != 0" Name="[Identifier]">((llvm::StringMapEntry&lt;clang::IdentifierInfo *&gt;*)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 Spertus01b14bf2016-03-16 14:27:50 +0000153 <DisplayString Condition="(Ptr &amp; PtrMask) == StoredIdentifier" IncludeView="cpp">{*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)}</DisplayString>
Zachary Turnerdfa871b2014-06-26 16:26:42 +0000154 <DisplayString Condition="(Ptr &amp; PtrMask) == StoredIdentifier">{{Identifier ({*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)})}}</DisplayString>
155 <DisplayString Condition="(Ptr &amp; PtrMask) == StoredObjCZeroArgSelector">{{ObjC Zero Arg Selector (*{(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)})}}</DisplayString>
156 <DisplayString Condition="(Ptr &amp; PtrMask) == StoredObjCOneArgSelector">{{ObjC One Arg Selector (*{(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)})}}</DisplayString>
Aaron Ballman83f197b2014-01-24 19:46:45 +0000157 <DisplayString Condition="(Ptr &amp; PtrMask) == StoredDeclarationNameExtra">{{Extra ({(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr &amp; ~PtrMask))-&gt;ExtraKindOrNumArgs})}}</DisplayString>
158 <Expand>
Zachary Turnerdfa871b2014-06-26 16:26:42 +0000159 <Item Condition="(Ptr &amp; PtrMask) == StoredIdentifier" Name="[Identifier]">*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)</Item>
160 <Item Condition="(Ptr &amp; PtrMask) == StoredObjCZeroArgSelector" Name="[ObjC Zero Arg Selector]">*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)</Item>
161 <Item Condition="(Ptr &amp; PtrMask) == StoredObjCOneArgSelector" Name="[ObjC One Arg Selector]">*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)</Item>
Aaron Ballman83f197b2014-01-24 19:46:45 +0000162 <Item Condition="(Ptr &amp; PtrMask) == StoredDeclarationNameExtra" Name="[Extra]">(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr &amp; ~PtrMask))-&gt;ExtraKindOrNumArgs</Item>
Mike Spertus288daa52016-03-08 16:14:23 +0000163 </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 Ballman83f197b2014-01-24 19:46:45 +0000171 </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 Turnerdfa871b2014-06-26 16:26:42 +0000181 <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 Spertus288daa52016-03-08 16:14:23 +0000196 <Type Name="clang::OpaquePtr&lt;*&gt;">
197 <DisplayString>{($T1 *)Ptr</DisplayString>
198 <Expand>
199 <ExpandedItem>($T1 *)Ptr</ExpandedItem>
200 </Expand>
201 </Type>
Aaron Ballman83f197b2014-01-24 19:46:45 +0000202</AutoVisualizer>