[PATCH] D18076: Improve Visual Studio visualizations of llvm::PointerUnion by increasing type correctness

Mike Spertus via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 19:45:52 PST 2016


mspertus created this revision.
mspertus added reviewers: aaron.ballman, zturner.
mspertus added a subscriber: cfe-commits.

The Visual Studio native visualizer in llvm.natvis displays the actual pointer in a PointerUnion as a void *. E.g.

    clang::Type const *: 0x02c4a880

Which doesn't make clear what the type looks like. With this change, we will display an actual Type *, resulting in a much better visualization that makes it clear that the clang::Type is a PointerType representing "Int *"

    clang::Type const *: 0x02c4a880 PointerType: BuiltinType: Int *

(Note, the above uses an upcoming visualizer for clang::PointerType because that is my test case, but that is orthogonal to this change).

http://reviews.llvm.org/D18076

Files:
  llvm.natvis

Index: llvm.natvis
===================================================================
--- llvm.natvis
+++ llvm.natvis
@@ -54,8 +54,8 @@
   </Type>
 
   <Type Name="llvm::PointerUnion<*,*>">
-    <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) == 0">{"$T1", s8b} {(void*)(Val.Value & Val.PointerBitMask)}</DisplayString>
-    <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) != 0">{"$T2", s8b} {(void*)(Val.Value & Val.PointerBitMask)}</DisplayString>
+    <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value & Val.PointerBitMask)}</DisplayString>
+    <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value & Val.PointerBitMask)}</DisplayString>
     <Expand>
       <ExpandedItem Condition="((Val.Value >> Val.IntShift) & Val.IntMask) == 0">($T1)(Val.Value & Val.PointerBitMask)</ExpandedItem>
       <ExpandedItem Condition="((Val.Value >> Val.IntShift) & Val.IntMask) != 0">($T2)(Val.Value & Val.PointerBitMask)</ExpandedItem>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18076.50391.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160311/d82f0663/attachment.bin>


More information about the cfe-commits mailing list