mspertus created this revision.
mspertus added reviewers: aaron.ballman, zturner, aemerson.
mspertus added a subscriber: cfe-commits.
Visualizer for clang::FunctionProtoType
Displays return type and parameters for the Function Protoype object in the
Locals window. For example, the prototype `int(double, A *)` displays as
```
T Int(Double, struct A *)
|-ReturnType Int
|-Parameter Types Double, struct A *
|-[0] BuiltinType {Double}
|-[1] PointerType {struct A *}
| /* More stuff */
```
http://reviews.llvm.org/D18297
Files:
clang.natvis
Index: clang.natvis
===================================================================
--- clang.natvis
+++ clang.natvis
@@ -29,6 +29,7 @@
<DisplayString
Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm"
IncludeView="poly">{*(clang::TemplateTypeParmType *)this}</DisplayString>
<DisplayString
Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm"
IncludeView="poly">{*(clang::SubstTemplateTypeParmType *)this}</DisplayString>
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Record"
IncludeView="poly">{*(clang::RecordType *)this}</DisplayString>
+ <DisplayString
Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto"
IncludeView="poly">{*(clang::FunctionProtoType *)this}</DisplayString>
<DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>
<DisplayString IncludeView="poly">{*this,view(cmn)}"</DisplayString> <!--
Not yet implemented Type subclass -->
<DisplayString>{*this,view(cmn)} {{{*this,view(poly)}}}</DisplayString>
@@ -44,6 +45,7 @@
<ExpandedItem ExcludeView="cmn"
Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm">(clang::TemplateTypeParmType
*)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn"
Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm">(clang::SubstTemplateTypeParmType
*)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn"
Condition="TypeBits.TC==clang::Type::TypeClass::Record">(clang::RecordType
*)this</ExpandedItem>
+ <ExpandedItem ExcludeView="cmn"
Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto">(clang::FunctionProtoType
*)this</ExpandedItem>
</Expand>
</Type>
<Type Name="clang::PointerType">
@@ -132,6 +134,36 @@
<Item Name="Replaced">*Replaced</Item>
</Expand>
</Type>
+ <!-- We only show the first 5 parameter types in the display string (can't
figure out how to loop in DisplayString)
+ but the expansion has all parameters -->
+ <Type Name="clang::FunctionProtoType">
+ <DisplayString IncludeView="parm0"
Condition="NumParams==0"></DisplayString>
+ <DisplayString IncludeView="parm0">{*(clang::QualType
*)(this+1),view(cpp)}{*this,view(parm1)}</DisplayString>
+ <DisplayString IncludeView="parm1"
Condition="NumParams==1"></DisplayString>
+ <DisplayString IncludeView="parm1">, {*((clang::QualType
*)(this+1)+1),view(cpp)}{*this,view(parm2)}</DisplayString>
+ <DisplayString IncludeView="parm2"
Condition="NumParams==2"></DisplayString>
+ <DisplayString IncludeView="parm2">, {*((clang::QualType
*)(this+1)+2),view(cpp)}{*this,view(parm3)}</DisplayString>
+ <DisplayString IncludeView="parm3"
Condition="NumParams==3"></DisplayString>
+ <DisplayString IncludeView="parm3">, {*((clang::QualType
*)(this+1)+3),view(cpp)}{*this,view(parm4)}</DisplayString>
+ <DisplayString IncludeView="parm4"
Condition="NumParams==4"></DisplayString>
+ <DisplayString IncludeView="parm4">, {*((clang::QualType
*)(this+1)+4),view(cpp)}{*this,view(parm5)}</DisplayString>
+ <DisplayString IncludeView="parm5"
Condition="NumParams==5"></DisplayString>
+ <DisplayString IncludeView="parm5">, /* expand for more params
*/</DisplayString>
+ <DisplayString>{ResultType,view(cpp)}({*this,view(parm0)})</DisplayString>
+ <Expand>
+ <Item Name="ReturnType">ResultType</Item>
+ <Synthetic Name="Parameter Types">
+ <DisplayString>{*this,view(parm0)}</DisplayString>
+ <Expand>
+ <ArrayItems>
+ <Size>NumParams</Size>
+ <ValuePointer>(clang::QualType *)(this+1)</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Synthetic>
+ <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
+ </Expand>
+ </Type>
<Type Name="clang::TemplateTypeParmType">
<DisplayString>typename {*TTPDecl,view(cpp)}</DisplayString>
</Type>
Index: clang.natvis
===================================================================
--- clang.natvis
+++ clang.natvis
@@ -29,6 +29,7 @@
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm" IncludeView="poly">{*(clang::TemplateTypeParmType *)this}</DisplayString>
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm" IncludeView="poly">{*(clang::SubstTemplateTypeParmType *)this}</DisplayString>
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Record" IncludeView="poly">{*(clang::RecordType *)this}</DisplayString>
+ <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto" IncludeView="poly">{*(clang::FunctionProtoType *)this}</DisplayString>
<DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>
<DisplayString IncludeView="poly">{*this,view(cmn)}"</DisplayString> <!-- Not yet implemented Type subclass -->
<DisplayString>{*this,view(cmn)} {{{*this,view(poly)}}}</DisplayString>
@@ -44,6 +45,7 @@
<ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateTypeParm">(clang::TemplateTypeParmType *)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::SubstTemplateTypeParm">(clang::SubstTemplateTypeParmType *)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::Record">(clang::RecordType *)this</ExpandedItem>
+ <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto">(clang::FunctionProtoType *)this</ExpandedItem>
</Expand>
</Type>
<Type Name="clang::PointerType">
@@ -132,6 +134,36 @@
<Item Name="Replaced">*Replaced</Item>
</Expand>
</Type>
+ <!-- We only show the first 5 parameter types in the display string (can't figure out how to loop in DisplayString)
+ but the expansion has all parameters -->
+ <Type Name="clang::FunctionProtoType">
+ <DisplayString IncludeView="parm0" Condition="NumParams==0"></DisplayString>
+ <DisplayString IncludeView="parm0">{*(clang::QualType *)(this+1),view(cpp)}{*this,view(parm1)}</DisplayString>
+ <DisplayString IncludeView="parm1" Condition="NumParams==1"></DisplayString>
+ <DisplayString IncludeView="parm1">, {*((clang::QualType *)(this+1)+1),view(cpp)}{*this,view(parm2)}</DisplayString>
+ <DisplayString IncludeView="parm2" Condition="NumParams==2"></DisplayString>
+ <DisplayString IncludeView="parm2">, {*((clang::QualType *)(this+1)+2),view(cpp)}{*this,view(parm3)}</DisplayString>
+ <DisplayString IncludeView="parm3" Condition="NumParams==3"></DisplayString>
+ <DisplayString IncludeView="parm3">, {*((clang::QualType *)(this+1)+3),view(cpp)}{*this,view(parm4)}</DisplayString>
+ <DisplayString IncludeView="parm4" Condition="NumParams==4"></DisplayString>
+ <DisplayString IncludeView="parm4">, {*((clang::QualType *)(this+1)+4),view(cpp)}{*this,view(parm5)}</DisplayString>
+ <DisplayString IncludeView="parm5" Condition="NumParams==5"></DisplayString>
+ <DisplayString IncludeView="parm5">, /* expand for more params */</DisplayString>
+ <DisplayString>{ResultType,view(cpp)}({*this,view(parm0)})</DisplayString>
+ <Expand>
+ <Item Name="ReturnType">ResultType</Item>
+ <Synthetic Name="Parameter Types">
+ <DisplayString>{*this,view(parm0)}</DisplayString>
+ <Expand>
+ <ArrayItems>
+ <Size>NumParams</Size>
+ <ValuePointer>(clang::QualType *)(this+1)</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Synthetic>
+ <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
+ </Expand>
+ </Type>
<Type Name="clang::TemplateTypeParmType">
<DisplayString>typename {*TTPDecl,view(cpp)}</DisplayString>
</Type>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits