]> granicus.if.org Git - clang/commitdiff
Visual Studio Visualizers for clang::FunctionDecl
authorMike Spertus <mike@spertus.com>
Sun, 20 Mar 2016 20:15:23 +0000 (20:15 +0000)
committerMike Spertus <mike@spertus.com>
Sun, 20 Mar 2016 20:15:23 +0000 (20:15 +0000)
Readably displays a FunctionDecl in the Visual Studio Locals Window something like:
  void g(int, double d, struct A && arr)

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

utils/clang.natvis

index bd4e09e79e7af7bff9f595c5f226c5f68ca40910..63f7f7634b1592f5544b08f929acc314617bdbee 100644 (file)
@@ -137,6 +137,7 @@ or create a symbolic link so it updates automatically.
   <!-- 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="retType">{ResultType,view(cpp)}</DisplayString>\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
@@ -149,7 +150,7 @@ or create a symbolic link so it updates automatically.
     <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
+    <DisplayString>{*this,view(retType)}({*this,view(parm0)})</DisplayString>\r
     <Expand>\r
       <Item Name="ReturnType">ResultType</Item>\r
       <Synthetic Name="Parameter Types">\r
@@ -234,6 +235,7 @@ or create a symbolic link so it updates automatically.
     </Expand>\r
   </Type>\r
   <Type Name="clang::DeclarationName">\r
+    <DisplayString Condition="Ptr == 0" IncludeView="cpp"></DisplayString>\r
     <DisplayString Condition="Ptr == 0">Empty</DisplayString>\r
     <DisplayString Condition="(Ptr &amp; PtrMask) == StoredIdentifier" IncludeView="cpp">{*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)}</DisplayString>\r
     <DisplayString Condition="(Ptr &amp; PtrMask) == StoredIdentifier">{{Identifier ({*(clang::IdentifierInfo *)(Ptr &amp; ~PtrMask)})}}</DisplayString>\r
@@ -270,12 +272,50 @@ or create a symbolic link so it updates automatically.
       <Item Name="InitStyle">(clang::VarDecl::InitializationStyle)InitStyle</Item>\r
     </Expand>\r
   </Type>\r
+  <Type Name="clang::DeclaratorDecl">\r
+    <DisplayString>{DeclType,view(cpp)} {Name,view(cpp)}</DisplayString>\r
+  </Type>\r
   <Type Name="clang::VarDecl">\r
-    <DisplayString>{Name}</DisplayString>\r
+    <DisplayString>{*(DeclaratorDecl*)this,nd}</DisplayString>\r
     <Expand>\r
       <ExpandedItem>*(DeclaratorDecl*)this,nd</ExpandedItem>\r
       <Item Name="VarDeclBits">VarDeclBits</Item>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::ParmVarDecl">\r
+    <DisplayString>{*(VarDecl*)this,nd}</DisplayString>\r
+    <Expand>\r
       <Item Name="ParmVarDeclBits">ParmVarDeclBits</Item>\r
+      <ExpandedItem>*(VarDecl*)this,nd</ExpandedItem>\r
+    </Expand>\r
+  </Type>\r
+  <Type Name="clang::FunctionDecl">\r
+    <DisplayString IncludeView="retType">{*(clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType,view(retType)}</DisplayString>\r
+    <DisplayString IncludeView="parm0" Condition="0 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm0">{*ParamInfo[0]}{*this,view(parm1)}</DisplayString>\r
+    <DisplayString IncludeView="parm1" Condition="1 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm1">, {*ParamInfo[1]}{*this,view(parm2)}</DisplayString>\r
+    <DisplayString IncludeView="parm2" Condition="2 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm2">, {*ParamInfo[2]}{*this,view(parm3)}</DisplayString>\r
+    <DisplayString IncludeView="parm3" Condition="3 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm3">, {*ParamInfo[3]}{*this,view(parm4)}</DisplayString>\r
+    <DisplayString IncludeView="parm4" Condition="4 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm4">, {*ParamInfo[4]}{*this,view(parm5)}</DisplayString>\r
+    <DisplayString IncludeView="parm5" Condition="5 == ((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams"></DisplayString>\r
+    <DisplayString IncludeView="parm5">, /* expand for more params */</DisplayString>\r
+    <DisplayString>{*this,view(retType)} {Name,view(cpp)}({*this,view(parm0)})</DisplayString>\r
+    <Expand>\r
+      <Item Name="ReturnType">*this,view(retType)</Item>\r
+      <Synthetic Name="Parameter Types">\r
+        <DisplayString>{*this,view(parm0)}</DisplayString>\r
+        <Expand>\r
+          <ArrayItems>\r
+            <Size>((clang::FunctionProtoType *)((clang::ExtQualsTypeCommonBase *)(((uintptr_t)DeclType.Value.Value) &amp; ~15))-&gt;BaseType)-&gt;NumParams</Size>\r
+            <ValuePointer>ParamInfo</ValuePointer>\r
+          </ArrayItems>\r
+        </Expand>\r
+      </Synthetic>\r
+      <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>\r
     </Expand>\r
   </Type>\r
   <Type Name="clang::OpaquePtr&lt;*&gt;">\r