Template-related improvements to Visual Studio visualizers
authorMike Spertus <mike@spertus.com>
Sat, 13 Jul 2019 15:27:53 +0000 (15:27 +0000)
committerMike Spertus <mike@spertus.com>
Sat, 13 Jul 2019 15:27:53 +0000 (15:27 +0000)
llvm-svn: 366007

clang/utils/ClangVisualizers/clang.natvis

index 42b674e..8b2bf49 100644 (file)
@@ -196,7 +196,11 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString IncludeView="MaybeEllipses" Condition="TypeForDecl == nullptr">(not yet known if parameter pack) </DisplayString>\r
     <DisplayString IncludeView="MaybeEllipses" Condition="((TemplateTypeParmType *)(((clang::ExtQualsTypeCommonBase *)(((uintptr_t)TypeForDecl->CanonicalType.Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType))->CanTTPTInfo.ParameterPack">...</DisplayString>\r
     <DisplayString IncludeView="MaybeEllipses" Condition="!((TemplateTypeParmType *)(((clang::ExtQualsTypeCommonBase *)(((uintptr_t)TypeForDecl->CanonicalType.Value.Value) &amp; ~(uintptr_t)((1 &lt;&lt; 4) - 1)))-&gt;BaseType))->CanTTPTInfo.ParameterPack"></DisplayString>\r
-    <DisplayString>{*this,view(TorC)} {*this,view(MaybeEllipses)}{Name,view(cpp)}</DisplayString> \r
+    <DisplayString IncludeView="DefaultArg" Condition="(DefaultArgument.ValueOrInherited.Val.Value&amp;3LL) == 0">{(TypeSourceInfo *)(DefaultArgument.ValueOrInherited.Val.Value&amp;~3LL),view(cpp)}</DisplayString>\r
+    <DisplayString IncludeView="DefaultArg">{{InheritedInitializer}}</DisplayString>\r
+    <DisplayString IncludeView="Initializer" Condition="DefaultArgument.ValueOrInherited.Val.Value&amp;~3LL">= {this,view(DefaultArg)na}</DisplayString>\r
+    <DisplayString IncludeView="Initializer"></DisplayString>\r
+    <DisplayString>{*this,view(TorC)} {*this,view(MaybeEllipses)}{Name,view(cpp)} {this,view(Initializer)na}</DisplayString> \r
   </Type>\r
   <Type Name="clang::TemplateDecl">\r
     <DisplayString>template{TemplateParams,na} {*TemplatedDecl};</DisplayString>\r
@@ -288,7 +292,7 @@ For later versions of Visual Studio, no setup is required-->
     </Expand>\r
   </Type>\r
   <Type Name="clang::SubstTemplateTypeParmType">\r
-    <DisplayString>{*Replaced,view(cpp)} &lt;= {CanonicalType,view(cpp)}</DisplayString>\r
+    <DisplayString>{{{*Replaced,view(cpp)} &lt;= {CanonicalType,view(cpp)}}}</DisplayString>\r
     <Expand>\r
       <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
       <Item Name="Replaced">*Replaced</Item>\r
@@ -353,7 +357,7 @@ For later versions of Visual Studio, no setup is required-->
     </Expand>\r
   </Type>\r
   <Type Name="clang::InjectedClassNameType">\r
-    <DisplayString>{InjectedType,view(cpp)}</DisplayString>\r
+    <DisplayString>{Decl,view(cpp)}</DisplayString>\r
     <Expand>\r
       <Item Name="Decl">Decl</Item>\r
       <Item Name="InjectedType">InjectedType</Item>\r
@@ -424,12 +428,21 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem>Ty</ExpandedItem>\r
     </Expand>\r
   </Type>\r
-  <Type Name="clang::TemplateArgumentLoc">\r
-    <DisplayString>{Argument}</DisplayString>\r
+  <Type Name="clang::TypeLoc">\r
+    <DisplayString>{(QualType *)&amp;Ty,na}</DisplayString>\r
     <Expand>\r
-      <ExpandedItem>Argument</ExpandedItem>\r
+      <Item Name="Ty">(QualType *)&amp;Ty</Item>\r
+      <Item Name="Data">Data</Item>\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::TypeLocBuilder">\r
+    <DisplayString Optional="true" Condition="LastTy.Value.Value==0">Not building anything</DisplayString>\r
+    <DisplayString Optional="true">Building a {LastTy}</DisplayString>\r
+  </Type>\r
+  <Type Name="clang::TemplateArgumentLoc">\r
+    <DisplayString IncludeView="cpp">{Argument,view(cpp)}</DisplayString>\r
+    <DisplayString>{Argument}</DisplayString>\r
+  </Type>\r
   <Type Name="clang::TemplateArgument">\r
     <DisplayString IncludeView="cpp" Condition="Integer.Kind == clang::TemplateArgument::ArgKind::Type">{*(clang::QualType *)&amp;TypeOrValue.V,view(cpp)}</DisplayString>\r
     <DisplayString Condition="Integer.Kind == clang::TemplateArgument::ArgKind::Type">{(clang::TemplateArgument::ArgKind)TypeOrValue.Kind,en} template argument: {*(clang::QualType *)&amp;TypeOrValue.V}</DisplayString>\r
@@ -459,6 +472,21 @@ For later versions of Visual Studio, no setup is required-->
       <!-- TODO: Other kinds-->\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::TemplateArgumentListInfo">\r
+    <DisplayString IncludeView ="elt0" Condition="Arguments.Size == 0"></DisplayString>\r
+    <DisplayString IncludeView ="elt0">{((TemplateArgumentLoc*)Arguments.BeginX)[0],view(cpp)}{*this,view(elt1)}</DisplayString>\r
+    <DisplayString IncludeView ="elt1" Condition="Arguments.Size == 1"></DisplayString>\r
+    <DisplayString IncludeView ="elt1">, {((TemplateArgumentLoc*)Arguments.BeginX)[1],view(cpp)}{*this,view(elt2)}</DisplayString>\r
+    <DisplayString IncludeView ="elt2" Condition="Arguments.Size == 2"></DisplayString>\r
+    <DisplayString IncludeView ="elt2">, {((TemplateArgumentLoc*)Arguments.BeginX)[2],view(cpp)}{*this,view(elt3)}</DisplayString>\r
+    <DisplayString IncludeView ="elt3" Condition="Arguments.Size == 3"></DisplayString>\r
+    <DisplayString IncludeView ="elt3">, {((TemplateArgumentLoc*)Arguments.BeginX)[3],view(cpp)}{*this,view(elt4)}</DisplayString>\r
+    <DisplayString IncludeView ="elt4" Condition="Arguments.Size == 4"></DisplayString>\r
+    <DisplayString IncludeView ="elt4">, ...</DisplayString>\r
+    <DisplayString Condition="Arguments.Size == 0">empty</DisplayString>\r
+    <DisplayString Condition="Arguments.Size != 0">&lt;{*this,view(elt0)}&gt;</DisplayString>\r
+    <DisplayString>Uninitialized</DisplayString>\r
+  </Type>\r
   <Type Name="clang::TemplateArgumentList">\r
     <DisplayString IncludeView="arg0" Condition="NumArguments==0"></DisplayString>\r
     <DisplayString IncludeView="arg0">{Arguments[0],view(cpp)}{*this,view(arg1)}</DisplayString>\r
@@ -483,6 +511,17 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString IncludeView="arg2" Condition="Length==2"></DisplayString>\r
     <DisplayString IncludeView="arg2">, {Data[2],view(cpp)}, ...</DisplayString>\r
     <DisplayString>&lt;{*this,view(arg0)}&gt;</DisplayString>\r
+    <Expand>\r
+      <Item Name="Length">Length</Item>\r
+      <Synthetic Name="Data">\r
+        <Expand>\r
+          <ArrayItems>\r
+            <Size>Length</Size>\r
+            <ValuePointer>Data</ValuePointer>\r
+          </ArrayItems>\r
+        </Expand>\r
+      </Synthetic>\r
+    </Expand>\r
   </Type>\r
   <Type Name="clang::MultiLevelTemplateArgumentList">\r
     <DisplayString IncludeView="level0" Condition="(llvm::ArrayRef&lt;clang::TemplateArgument&gt; *)TemplateArgumentLists.EndX - (llvm::ArrayRef&lt;clang::TemplateArgument&gt; *)TemplateArgumentLists.BeginX==0"></DisplayString>\r
@@ -558,6 +597,7 @@ For later versions of Visual Studio, no setup is required-->
         <Size>TemplateSpecializationTypeBits.NumArgs</Size>\r
         <ValuePointer>(clang::TemplateArgument *)(this+1)</ValuePointer>\r
       </ArrayItems>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
     </Expand>\r
   </Type>\r
   <Type Name="clang::DeducedType">\r
@@ -745,7 +785,7 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString>{this,view(retType)nand} {Name,view(cpp)nd}({*this,view(parm0)nd})</DisplayString>\r
     <Expand>\r
       <ExpandedItem>(clang::DeclaratorDecl *)this,nd</ExpandedItem>\r
-      <Item Name="ReturnType">*this,view(retType)nd</Item>\r
+      <Item Name="ReturnType">((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)->ResultType</Item>\r
       <Synthetic Name="Parameter Types">\r
         <DisplayString>{*this,view(parm0)nd}</DisplayString>\r
         <Expand>\r
@@ -755,6 +795,7 @@ For later versions of Visual Studio, no setup is required-->
           </ArrayItems>\r
         </Expand>\r
       </Synthetic>\r
+      <Item Name="TemplateOrSpecialization">TemplateOrSpecialization</Item>\r
     </Expand>\r
   </Type>\r
   <Type Name="clang::OpaquePtr&lt;*&gt;">\r