Author: mps Date: Sat Jun 11 15:15:19 2016 New Revision: 272487 URL: http://llvm.org/viewvc/llvm-project?rev=272487&view=rev Log: 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 Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272487&r1=272486&r2=272487&view=diff ============================================================================== --- cfe/trunk/utils/ClangVisualizers/clang.natvis (original) +++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sat Jun 11 15:15:19 2016 @@ -20,6 +20,7 @@ For later versions of Visual Studio, no 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 <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 <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 <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 <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> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits