[PATCH] Add some natvis visualizers for llvm::Value and llvm::Type
Zachary Turner
zturner at google.com
Thu Jun 26 11:42:05 PDT 2014
Hi aaron.ballman,
Figures out the derived type of an llvm::Type, and adds an entry to the watch window that automatically casts to the derived type.
I'm not very good at writing these, so I'm not sure if this is the best possible way to express this.
http://reviews.llvm.org/D4316
Files:
utils/llvm.natvis
Index: utils/llvm.natvis
===================================================================
--- utils/llvm.natvis
+++ utils/llvm.natvis
@@ -166,4 +166,36 @@
<Item Name="[underlying]" Condition="hasVal">*(($T1 *)(unsigned char *)storage.buffer)</Item>
</Expand>
</Type>
+
+ <Type Name="llvm::Value">
+ <DisplayString Condition="Name != 0">{Name}</DisplayString>
+ <Expand>
+ <Item Name="VTy">VTy</Item>
+ <Item Name="UseList">UseList</Item>
+ <Item Name="Name">Name</Item>
+ <Item Name="SubclassID">(llvm::Value::ValueTy)SubclassID</Item>
+ <Item Name="HasValueHandle">(bool)HasValueHandle</Item>
+ <Item Name="SubclassOptionalData">SubclassOptionalData</Item>
+ <Item Name="SubclassData">SubclassData</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::Type">
+ <DisplayString>{(llvm::Type::TypeID)(IDAndSubclassData & 255)}</DisplayString>
+ <Expand>
+ <Item Name="[Integer Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::IntegerTyID">*(llvm::IntegerType*)this</Item>
+ <Item Name="[Function Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::FunctionTyID">*(llvm::FunctionType*)this</Item>
+ <Item Name="[Struct Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::StructTyID">*(llvm::StructType*)this</Item>
+ <Item Name="[Array Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::ArrayTyID">*(llvm::ArrayType*)this</Item>
+ <Item Name="[Pointer Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::PointerTyID">*(llvm::PointerType*)this</Item>
+ <Item Name="[Vector Type]" Condition="(IDAndSubclassData & 255) == llvm::Type::VectorTyID">*(llvm::VectorType*)this</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::SequentialType">
+ <Expand>
+ <Item Name="ContainedType">ContainedType</Item>
+ <ExpandedItem>*(llvm::Type*)this,nd</ExpandedItem>
+ </Expand>
+ </Type>
</AutoVisualizer>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4316.10899.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140626/99703a10/attachment.bin>
More information about the llvm-commits
mailing list