[PATCH] Add a natvis visualizer for VarDecl.
Aaron Ballman
aaron.ballman at gmail.com
Thu Jun 26 07:12:04 PDT 2014
LGTM!
Thanks!
~Aaron
On Wed, Jun 25, 2014 at 8:31 PM, Zachary Turner <zturner at google.com> wrote:
> Hi aaron.ballman,
>
> Adds a natvis Visualizer for VarDecl. Specifically, this visualizer behaves as follows:
>
> 1) Displays the name of the declaration as the DisplayString
> 2) Translates some of the bitfields into their corresponding enumeration values
> 3) Converts some of the existing visualizers to deref their pointers, so their DisplayStrings don't show the pointer address (increases verbosity for little gain)
>
> http://reviews.llvm.org/D4303
>
> Files:
> utils/clang.natvis
>
> Index: utils/clang.natvis
> ===================================================================
> --- utils/clang.natvis
> +++ utils/clang.natvis
> @@ -15,14 +15,14 @@
> </Type>
> <Type Name="clang::DeclarationName">
> <DisplayString Condition="Ptr == 0">Empty</DisplayString>
> - <DisplayString Condition="(Ptr & PtrMask) == StoredIdentifier">{{Identifier ({(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> - <DisplayString Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector">{{ObjC Zero Arg Selector ({(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> - <DisplayString Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector">{{ObjC One Arg Selector ({(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> + <DisplayString Condition="(Ptr & PtrMask) == StoredIdentifier">{{Identifier ({*(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> + <DisplayString Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector">{{ObjC Zero Arg Selector (*{(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> + <DisplayString Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector">{{ObjC One Arg Selector (*{(clang::IdentifierInfo *)(Ptr & ~PtrMask)})}}</DisplayString>
> <DisplayString Condition="(Ptr & PtrMask) == StoredDeclarationNameExtra">{{Extra ({(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr & ~PtrMask))->ExtraKindOrNumArgs})}}</DisplayString>
> <Expand>
> - <Item Condition="(Ptr & PtrMask) == StoredIdentifier" Name="[Identifier]">(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> - <Item Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector" Name="[ObjC Zero Arg Selector]">(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> - <Item Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector" Name="[ObjC One Arg Selector]">(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> + <Item Condition="(Ptr & PtrMask) == StoredIdentifier" Name="[Identifier]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> + <Item Condition="(Ptr & PtrMask) == StoredObjCZeroArgSelector" Name="[ObjC Zero Arg Selector]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> + <Item Condition="(Ptr & PtrMask) == StoredObjCOneArgSelector" Name="[ObjC One Arg Selector]">*(clang::IdentifierInfo *)(Ptr & ~PtrMask)</Item>
> <Item Condition="(Ptr & PtrMask) == StoredDeclarationNameExtra" Name="[Extra]">(clang::DeclarationNameExtra::ExtraKind)((clang::DeclarationNameExtra *)(Ptr & ~PtrMask))->ExtraKindOrNumArgs</Item>
> </Expand>
> </Type>
> @@ -41,4 +41,19 @@
> <Type Name="clang::DirectoryEntry">
> <DisplayString>{Name,s}</DisplayString>
> </Type>
> + <Type Name="clang::VarDecl::VarDeclBitfields">
> + <Expand>
> + <Item Name="StorageClass">(clang::StorageClass)SClass</Item>
> + <Item Name="ThreadStorageClass">(clang::ThreadStorageClassSpecifier)TSCSpec</Item>
> + <Item Name="InitStyle">(clang::VarDecl::InitializationStyle)InitStyle</Item>
> + </Expand>
> + </Type>
> + <Type Name="clang::VarDecl">
> + <DisplayString>{Name}</DisplayString>
> + <Expand>
> + <ExpandedItem>*(DeclaratorDecl*)this,nd</ExpandedItem>
> + <Item Name="VarDeclBits">VarDeclBits</Item>
> + <Item Name="ParmVarDeclBits">ParmVarDeclBits</Item>
> + </Expand>
> + </Type>
> </AutoVisualizer>
More information about the cfe-commits
mailing list