<div dir="ltr">Yea, I'm not sure.  I agree it's annoying, but if you only add SubclassID and then let the rest still be visible through Raw View, it's kind of awkward expanding the node and not seeing anything.  Someone not familliar with the natvis stuff woudl think there's something wrong.  I was trying to do something like adding a row called SubclassID with the cast value, and then using an <ExpandedItem> to display "this" without the visualizer applied, but I couldn't get that to work.  Do you know how?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 2:05 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron.ballman@gmail.com" target="_blank">aaron.ballman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Jun 26, 2014 at 5:01 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>

> Added some more for llvm::Instruction to display the Opcode.<br>
><br>
> <a href="http://reviews.llvm.org/D4316" target="_blank">http://reviews.llvm.org/D4316</a><br>
><br>
> Files:<br>
>   utils/llvm.natvis<br>
><br>
> Index: utils/llvm.natvis<br>
> ===================================================================<br>
> --- utils/llvm.natvis<br>
> +++ utils/llvm.natvis<br>
> @@ -166,4 +166,75 @@<br>
>        <Item Name="[underlying]" Condition="hasVal">*(($T1 *)(unsigned char *)storage.buffer)</Item><br>
>      </Expand><br>
>    </Type><br>
> +<br>
> +  <Type Name="llvm::Value"><br>
> +    <DisplayString Condition="Name != 0">{Name}</DisplayString><br>
> +    <DisplayString>{{anonymous value}}</DisplayString><br>
> +    <Expand><br>
> +      <Item Name="VTy">VTy</Item><br>
> +      <Item Name="UseList">UseList</Item><br>
> +      <Item Name="Name">Name</Item><br>
> +      <Item Name="SubclassID">(llvm::Value::ValueTy)SubclassID</Item><br>
> +      <Item Name="HasValueHandle">(bool)HasValueHandle</Item><br>
> +      <Item Name="SubclassOptionalData">SubclassOptionalData</Item><br>
> +      <Item Name="SubclassData">SubclassData</Item><br>
<br>
</div></div>It's unfortunate that all of this has to be duplicated just so<br>
SubclassID can be cast... Would it make more sense to just add that<br>
field, and allow access to the rest through Raw View (even though it's<br>
an extra click)? Any changes to Value may not be reflected in here,<br>
which is why I'm slightly concerned.<br>
<div class="HOEnZb"><div class="h5"><br>
> +    </Expand><br>
> +  </Type><br>
> +<br>
> +  <Type Name="llvm::Type"><br>
> +    <DisplayString>{(llvm::Type::TypeID)(IDAndSubclassData &amp; 255)}</DisplayString><br>
> +    <Expand><br>
> +      <Item Name="[Integer Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::IntegerTyID">*(llvm::IntegerType*)this</Item><br>
> +      <Item Name="[Function Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::FunctionTyID">*(llvm::FunctionType*)this</Item><br>
> +      <Item Name="[Struct Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::StructTyID">*(llvm::StructType*)this</Item><br>
> +      <Item Name="[Array Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::ArrayTyID">*(llvm::ArrayType*)this</Item><br>
> +      <Item Name="[Pointer Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::PointerTyID">*(llvm::PointerType*)this</Item><br>
> +      <Item Name="[Vector Type]" Condition="(IDAndSubclassData &amp; 255) == llvm::Type::VectorTyID">*(llvm::VectorType*)this</Item><br>
> +    </Expand><br>
> +  </Type><br>
> +<br>
> +  <Type Name="llvm::SequentialType"><br>
> +    <Expand><br>
> +      <Item Name="ContainedType">ContainedType</Item><br>
> +      <ExpandedItem>*(llvm::Type*)this,nd</ExpandedItem><br>
> +    </Expand><br>
> +  </Type><br>
> +<br>
> +  <Type Name="llvm::Instruction"><br>
> +    <Expand><br>
> +      <Synthetic Name="[Opcode]"><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Call">Call</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Add">Add</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Sub">Sub</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Mul">Mul</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::SDiv">SDiv</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::UDiv">UDiv</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::SRem">SRem</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::URem">URem</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Shl">Shl</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::LShr">LShr</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::AShr">AShr</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::And">And</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Or">Or</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Xor">Xor</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Alloca">Alloca</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::BitCast">BitCast</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::ZExt">ZExt</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::SExt">SExt</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Br">Br</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::GetElementPtr">GetElementPtr</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::ICmp">ICmp</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::IntToPtr">IntToPtr</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::PtrToInt">PtrToInt</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Trunc">Trunc</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Load">Load</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Ret">Ret</DisplayString><br>
> +        <DisplayString Condition="(SubclassID - InstructionVal) == Instruction::Store">Store</DisplayString><br>
> +        <DisplayString>{{Unknown}}</DisplayString><br>
> +      </Synthetic><br>
> +      <Item Name="Parent">Parent</Item><br>
> +      <Item Name="DebugLoc">DbgLoc</Item><br>
> +      <ExpandedItem>(llvm::User*)this,nd</ExpandedItem><br>
> +    </Expand><br>
> +  </Type><br>
>  </AutoVisualizer><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">~Aaron<br>
</font></span></blockquote></div><br></div>