]> granicus.if.org Git - clang/commitdiff
MSVC visualizers for type aliases
authorMike Spertus <mike@spertus.com>
Sun, 23 Jun 2019 01:15:48 +0000 (01:15 +0000)
committerMike Spertus <mike@spertus.com>
Sun, 23 Jun 2019 01:15:48 +0000 (01:15 +0000)
For example, the following TypeAliasTemplateDecl now displays in the autos window as
template<class T> using type_identity_t = type_identity<T>::type;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364145 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ClangVisualizers/clang.natvis

index 33d2a3dcfd79b06e71f7024a426913ae8f16d6c8..8f17a2a6194342d4a6f1586710aa2cb49a39a9a6 100644 (file)
@@ -33,6 +33,8 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::IncompleteArray" IncludeView="poly">{(clang::IncompleteArrayType *)this,na}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::IncompleteArray" IncludeView="left">{(clang::IncompleteArrayType *)this,view(left)na}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::IncompleteArray" IncludeView="right">{(clang::IncompleteArrayType *)this,view(right)na}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Typedef" IncludeView="poly">{(clang::TypedefType *)this,na}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Typedef" IncludeView="cpp">{(clang::TypedefType *)this,view(cpp)na}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Attributed" IncludeView="poly">{*(clang::AttributedType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Decayed" IncludeView="poly">{(clang::DecayedType *)this,na}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Decayed" IncludeView="left">{(clang::DecayedType *)this,view(left)na}</DisplayString>\r
@@ -48,6 +50,7 @@ For later versions of Visual Studio, no setup is required-->
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization" IncludeView="poly">{*(clang::TemplateSpecializationType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::DeducedTemplateSpecialization" IncludeView="poly">{*(clang::DeducedTemplateSpecializationType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName" IncludeView="poly">{*(clang::InjectedClassNameType *)this}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::DependentName" IncludeView="poly">{*(clang::DependentNameType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::PackExpansion" IncludeView="poly">{*(clang::PackExpansionType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::LocInfoType::LocInfo" IncludeView="poly">{*(clang::LocInfoType *)this}</DisplayString>\r
     <DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>\r
@@ -93,6 +96,7 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization">(clang::TemplateSpecializationType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::DeducedTemplateSpecialization">(clang::DeducedTemplateSpecializationType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName">(clang::InjectedClassNameType *)this</ExpandedItem>\r
+      <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::DependentName">(clang::DependentNameType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::PackExpansion">(clang::PackExpansionType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::LocInfoType::LocInfo">(clang::LocInfoType *)this</ExpandedItem>\r
     </Expand>\r
@@ -119,6 +123,14 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem>(clang::ArrayType *)this</ExpandedItem>\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::TypedefType">\r
+    <DisplayString IncludeView="cpp">{Decl,view(name)nd}</DisplayString>\r
+    <DisplayString>{Decl}</DisplayString>\r
+    <Expand>\r
+      <Item Name="Decl">Decl</Item>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
   <Type Name="clang::PointerType">\r
     <DisplayString>{PointeeType, view(poly)} *</DisplayString>\r
     <Expand>\r
@@ -192,6 +204,24 @@ For later versions of Visual Studio, no setup is required-->
       <Item Name="TemplatedDecl">TemplatedDecl,na</Item>\r
     </Expand>\r
   </Type>\r
+  <!-- Unfortunately, visualization of PointerIntPair<PointerUnion> doesn't work due to limitations in natvis, so we will barehad it-->\r
+  <Type Name="clang::TypedefNameDecl">\r
+    <DisplayString Condition="(MaybeModedTInfo.Value &amp; 4)==0" IncludeView="type">{(clang::TypeSourceInfo *)(MaybeModedTInfo.Value &amp; ~7LL),view(cpp)na}</DisplayString>\r
+    <DisplayString Condition="(MaybeModedTInfo.Value &amp; 4)!=0" IncludeView="type">{(clang::TypedefNameDecl::ModedTInfo *)(MaybeModedTInfo.Value &amp; ~7LL),view(cpp)na}</DisplayString>\r
+    <DisplayString IncludeView="name">{(TypeDecl *)this,view(cpp)nand}</DisplayString>\r
+    <DisplayString>typedef {this,view(type)na} {this,view(name)};</DisplayString>\r
+    <Expand>\r
+      <Item Name="IsTransparent" Condition="(MaybeModedTInfo.Value &amp; 1)==0">"Not yet calculated",sb</Item>\r
+      <Item Name="IsTransparent" Condition="(MaybeModedTInfo.Value &amp; 1)!=0">(bool)(MaybeModedTInfo.Value &amp; 2)</Item>\r
+      <Item Name="TypeSourceInfo" Condition="(MaybeModedTInfo.Value &amp; 4)==0">(clang::TypeSourceInfo *)(MaybeModedTInfo.Value &amp; ~7LL)</Item>\r
+      <Item Name="ModedTInfo" Condition="(MaybeModedTInfo.Value &amp; 4)!=0">(clang::TypedefNameDecl::ModedTInfo *)(MaybeModedTInfo.Value &amp; ~7LL)</Item>\r
+      <ExpandedItem>(TypeDecl *)this,nd</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::TypeAliasDecl">\r
+    <DisplayString>using {(TypedefNameDecl *)this,view(name)nand} = {(TypedefNameDecl *)this,view(type)nand}</DisplayString>\r
+  </Type>\r
+\r
   <Type Name="clang::TemplateName">\r
     <DisplayString>{Storage,na}</DisplayString>\r
     <Expand>\r
@@ -303,6 +333,23 @@ For later versions of Visual Studio, no setup is required-->
       <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::DependentNameType">\r
+    <DisplayString>{NNS}{Name,view(cpp)na}</DisplayString>\r
+    <Expand>\r
+      <Item Name="NNS">NNS</Item>\r
+      <Item Name="Name">Name</Item>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::NestedNameSpecifier">\r
+    <DisplayString Condition="!Specifier"></DisplayString>\r
+    <DisplayString Condition="((Prefix.Value&gt;&gt;1)&amp;3) == 0">{(IdentifierInfo*)Specifier,view(cpp)na}::</DisplayString>\r
+    <DisplayString Condition="((Prefix.Value&gt;&gt;1)&amp;3) == 1">{(NamedDecl*)Specifier,view(cpp)na}::</DisplayString>\r
+    <DisplayString Condition="((Prefix.Value&gt;&gt;1)&amp;2) == 2">{(Type*)Specifier,view(cpp)na}::</DisplayString>\r
+    <Expand>\r
+      <Item Name="Kind">(NestedNameSpecifier::StoredSpecifierKind)((Prefix.Value&gt;&gt;1)&amp;3)</Item>\r
+    </Expand>\r
+  </Type>\r
   <Type Name="clang::PackExpansionType">\r
     <DisplayString>{Pattern}</DisplayString>\r
     <Expand>\r
@@ -343,7 +390,11 @@ For later versions of Visual Studio, no setup is required-->
     </Expand>\r
   </Type>\r
   <Type Name="clang::TypeSourceInfo">\r
+    <DisplayString IncludeView="cpp">{Ty,view(cpp)}</DisplayString>\r
     <DisplayString>{Ty}</DisplayString>\r
+    <Expand>\r
+      <ExpandedItem>Ty</ExpandedItem>\r
+    </Expand>\r
   </Type>\r
   <Type Name="clang::TemplateArgumentLoc">\r
     <DisplayString>{Argument}</DisplayString>\r