diff options
author | Mike Spertus <mike@spertus.com> | 2016-06-11 20:15:19 +0000 |
---|---|---|
committer | Mike Spertus <mike@spertus.com> | 2016-06-11 20:15:19 +0000 |
commit | 13a66b76e40619c2f1cf47c6f88db1763bdf292f (patch) | |
tree | 7a8070476593994d10f1afcb83f1c61f7defb2d5 /utils | |
parent | c306c03ef956b486ff210b694458423caa0867db (diff) |
Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo
Created a visualizer for ActionResult that displayed the validity and the pointer,
but many of them initially displayed poorly. It turns out that the primary culprit
is that LocInfoType is often passed in an action result, but it is not the same
as other types. For example, LocInfoType is not in TypeNodes.def and clang::Type::TypeClass
does not have a LocInfoType enum. After adding a special visualizer for LocInfoType,
the display was more useful
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ClangVisualizers/clang.natvis | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/utils/ClangVisualizers/clang.natvis b/utils/ClangVisualizers/clang.natvis index 62cea41950..f5e13819e1 100644 --- a/utils/ClangVisualizers/clang.natvis +++ b/utils/ClangVisualizers/clang.natvis @@ -20,6 +20,7 @@ For later versions of Visual Studio, no setup is required--> containing all the gory details.
"cpp": Only occasionally used when we need to distinguish between an ordinary view and a C++-like view.
-->
+ <DisplayString IncludeView="cmn" Condition="TypeBits.TC==clang::LocInfoType::LocInfo">LocInfoType</DisplayString>
<DisplayString IncludeView="cmn">{(clang::Type::TypeClass)TypeBits.TC, en}Type</DisplayString>
<!-- Dispatch to visualizers for the actual Type subclass -->
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::Builtin" IncludeView="poly">{*(clang::BuiltinType *)this}</DisplayString>
@@ -34,6 +35,7 @@ For later versions of Visual Studio, no setup is required--> <DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto" IncludeView="poly">{*(clang::FunctionProtoType *)this}</DisplayString>
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization" IncludeView="poly">{*(clang::TemplateSpecializationType *)this}</DisplayString>
<DisplayString Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName" IncludeView="poly">{*(clang::InjectedClassNameType *)this}</DisplayString>
+ <DisplayString Condition="TypeBits.TC==clang::LocInfoType::LocInfo" IncludeView="poly">{*(clang::LocInfoType *)this}</DisplayString>
<DisplayString IncludeView="cpp">{*this,view(poly)}</DisplayString>
<DisplayString IncludeView="poly">{*this,view(cmn)}</DisplayString> <!-- Not yet implemented Type subclass -->
<DisplayString>{*this,view(cmn)} {{{*this,view(poly)}}}</DisplayString>
@@ -52,6 +54,7 @@ For later versions of Visual Studio, no setup is required--> <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::FunctionProto">(clang::FunctionProtoType *)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::TemplateSpecialization">(clang::TemplateSpecializationType *)this</ExpandedItem>
<ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::Type::TypeClass::InjectedClassName">(clang::InjectedClassNameType *)this</ExpandedItem>
+ <ExpandedItem ExcludeView="cmn" Condition="TypeBits.TC==clang::LocInfoType::LocInfo">(clang::LocInfoType *)this</ExpandedItem>
</Expand>
</Type>
<Type Name="clang::PointerType">
@@ -226,6 +229,16 @@ For later versions of Visual Studio, no setup is required--> <Item Name="BaseType">*((clang::ExtQualsTypeCommonBase *)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 1)))->BaseType</Item>
</Expand>
</Type>
+ <Type Name="clang::LocInfoType">
+ <DisplayString>{*DeclInfo}</DisplayString>
+ <Expand>
+ <Item Name="DeclInfo">DeclInfo</Item>
+ <ExpandedItem>*(clang::Type *)this, view(cmn)</ExpandedItem>
+ </Expand>
+ </Type>
+ <Type Name="clang::TypeSourceInfo">
+ <DisplayString>{Ty}</DisplayString>
+ </Type>
<Type Name="clang::TemplateArgumentLoc">
<DisplayString>{Argument}</DisplayString>
<Expand>
@@ -499,4 +512,30 @@ For later versions of Visual Studio, no setup is required--> <DisplayString Condition="ResultKind == clang::LookupResult::Ambiguous">{Ambiguity,en}: {Decls}</DisplayString>
<DisplayString>{ResultKind,en}: {Decls}</DisplayString>
</Type>
+ <Type Name="clang::ActionResult<*>" IncludeView="packedValidity">
+ <DisplayString Condition="PtrWithInvalid&1">Invalid</DisplayString>
+ <DisplayString Condition="!(PtrWithInvalid&1)">Valid</DisplayString>
+ </Type>
+ <Type Name="clang::ActionResult<*>" IncludeView="unpackedValidity">
+ <DisplayString Condition="Invalid">Invalid</DisplayString>
+ <DisplayString Condition="!Invalid">Valid</DisplayString>
+ </Type>
+ <Type Name="clang::ActionResult<*>" IncludeView="packed">
+ <DisplayString>{*this,view(packedValidity)}: {($T1 *)(PtrWithInvalid&~1)}</DisplayString>
+ <Expand>
+ <Item Name="Invalid">(bool)(PtrWithInvalid&1)</Item>
+ <Item Name="Val">($T1 *)(PtrWithInvalid&~1)</Item>
+ </Expand>
+ </Type>
+ <Type Name="clang::ActionResult<*>" IncludeView="unpacked">
+ <DisplayString>{*this,view(unpackedValidity)}: {Val}</DisplayString>
+ </Type>
+ <Type Name="clang::ActionResult<*>">
+ <DisplayString Condition="$T2">{*this,view(packed)}</DisplayString>
+ <DisplayString Condition="!$T2">{*this,view(unpacked)}</DisplayString>
+ <Expand>
+ <ExpandedItem Condition="$T2">*this,view(packed)</ExpandedItem>
+ <ExpandedItem Condition="!$T2">*this,view(unpacked)</ExpandedItem>
+ </Expand>
+ </Type>
</AutoVisualizer>
|