[PATCH] Add some natvis visualizers for llvm::Value and llvm::Type

Aaron Ballman aaron.ballman at gmail.com
Thu Jun 26 14:01:30 PDT 2014


On Thu, Jun 26, 2014 at 2:42 PM, Zachary Turner <zturner at google.com> wrote:
> 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.

This looks reasonable to me. There may be a better way to do it, but
if there is, I certainly am unaware of it. :-)

Thanks!

~Aaron

>
> 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>



More information about the llvm-commits mailing list