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

Zachary Turner zturner at google.com
Thu Jun 26 14:04:01 PDT 2014


Looks like we crossed paths.  I just submitted an update to this at this
very moment, although I changed the title of the review.  Either way,
visualizers aren't too critical so if I'll just push it in sometime later
today.  If you have any feedback though let me know as I'm still learning
this natvis stuff.

BTW, do you think there would be any interest in having a DLL where we
could write arbitrary code to generate the visualization tree?  It seems
like natvis is frustratingly limited in what you can specify.


On Thu, Jun 26, 2014 at 2:01 PM, Aaron Ballman <aaron.ballman at gmail.com>
wrote:

> 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>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140626/cb94d00d/attachment.html>


More information about the llvm-commits mailing list