]> granicus.if.org Git - clang/commitdiff
Visual Studio Visualizer for clang::FunctionProtoType
authorMike Spertus <mike@spertus.com>
Sun, 20 Mar 2016 00:20:43 +0000 (00:20 +0000)
committerMike Spertus <mike@spertus.com>
Sun, 20 Mar 2016 00:20:43 +0000 (00:20 +0000)
Displays return type and parameters for the Function Protoype object in the Locals window.

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

utils/clang.natvis

index cb7b01d2e267da438b36013164079d9747dcfb18..0c5101215be5b13255f4e8ccd6bae893c91a15c5 100644 (file)
@@ -29,6 +29,7 @@ or create a symbolic link so it updates automatically.
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm" IncludeView="poly">{*(clang::TemplateTypeParmType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm" IncludeView="poly">{*(clang::SubstTemplateTypeParmType *)this}</DisplayString>\r
     <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Record" IncludeView="poly">{*(clang::RecordType *)this}</DisplayString>\r
+    <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto" IncludeView="poly">{*(clang::FunctionProtoType *)this}</DisplayString>\r
     <DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>\r
     <DisplayString IncludeView="poly">{*this,view(cmn)}"</DisplayString> <!-- Not yet implemented Type subclass -->\r
     <DisplayString>{*this,view(cmn)}  {{{*this,view(poly)}}}</DisplayString>\r
@@ -44,6 +45,7 @@ or create a symbolic link so it updates automatically.
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm">(clang::TemplateTypeParmType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm">(clang::SubstTemplateTypeParmType *)this</ExpandedItem>\r
       <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Record">(clang::RecordType *)this</ExpandedItem>\r
+      <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto">(clang::FunctionProtoType *)this</ExpandedItem>\r
     </Expand>\r
   </Type>\r
   <Type Name="clang::PointerType">\r
@@ -132,6 +134,36 @@ or create a symbolic link so it updates automatically.
       <Item Name="Replaced">*Replaced</Item>\r
     </Expand>\r
   </Type>\r
+  <!-- We only show the first 5 parameter types in the display string (can't figure out how to loop in DisplayString)\r
+       but the expansion has all parameters -->\r
+  <Type Name="clang::FunctionProtoType">\r
+    <DisplayString IncludeView="parm0" Condition="NumParams==0"></DisplayString>\r
+    <DisplayString IncludeView="parm0">{*(clang::QualType *)(this+1),view(cpp)}{*this,view(parm1)}</DisplayString>\r
+    <DisplayString IncludeView="parm1" Condition="NumParams==1"></DisplayString>\r
+    <DisplayString IncludeView="parm1">, {*((clang::QualType *)(this+1)+1),view(cpp)}{*this,view(parm2)}</DisplayString>\r
+    <DisplayString IncludeView="parm2" Condition="NumParams==2"></DisplayString>\r
+    <DisplayString IncludeView="parm2">, {*((clang::QualType *)(this+1)+2),view(cpp)}{*this,view(parm3)}</DisplayString>\r
+    <DisplayString IncludeView="parm3" Condition="NumParams==3"></DisplayString>\r
+    <DisplayString IncludeView="parm3">, {*((clang::QualType *)(this+1)+3),view(cpp)}{*this,view(parm4)}</DisplayString>\r
+    <DisplayString IncludeView="parm4" Condition="NumParams==4"></DisplayString>\r
+    <DisplayString IncludeView="parm4">, {*((clang::QualType *)(this+1)+4),view(cpp)}{*this,view(parm5)}</DisplayString>\r
+    <DisplayString IncludeView="parm5" Condition="NumParams==5"></DisplayString>\r
+    <DisplayString IncludeView="parm5">, /* expand for more params */</DisplayString>\r
+    <DisplayString>{ResultType,view(cpp)}({*this,view(parm0)})</DisplayString>\r
+    <Expand>\r
+      <Item Name="ReturnType">ResultType</Item>\r
+      <Synthetic Name="Parameter Types">\r
+        <DisplayString>{*this,view(parm0)}</DisplayString>\r
+        <Expand>\r
+          <ArrayItems>\r
+            <Size>NumParams</Size>\r
+            <ValuePointer>(clang::QualType *)(this+1)</ValuePointer>\r
+          </ArrayItems>\r
+        </Expand>\r
+      </Synthetic>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
   <Type Name="clang::TemplateTypeParmType">\r
     <DisplayString>typename {*TTPDecl,view(cpp)}</DisplayString>\r
   </Type>\r