Skip to content

Commit 19e5fc4

Browse files
committed
STL.natvis: Simplify visualization for string
It appears that debugger visualizer accepts `na` regardless if underlying char type
1 parent 89ca073 commit 19e5fc4

File tree

1 file changed

+5
-78
lines changed

1 file changed

+5
-78
lines changed

stl/debugger/STL.natvis

Lines changed: 5 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,11 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10051005
* wchar_t / unsigned short / char16_t = su format
10061006
* char32_t = s32 format
10071007
-->
1008-
<Type Name="std::basic_string&lt;char,*&gt;">
1009-
<AlternativeType Name="std::basic_string&lt;char8_t,*&gt;" />
1010-
1008+
<Type Name="std::basic_string&lt;*,*&gt;">
10111009
<Intrinsic Name="size" Expression="_Mypair._Myval2._Mysize" />
10121010
<Intrinsic Name="capacity" Expression="_Mypair._Myval2._Myres" />
1013-
<!-- _BUF_SIZE = 16 / sizeof(char) &lt; 1 ? 1 : 16 / sizeof(char) == 16 -->
1014-
<Intrinsic Name="bufSize" Expression="16" />
1011+
<!-- _BUF_SIZE = 16 / sizeof($T1) &lt; 1 ? 1 : 16 / sizeof($T1) -->
1012+
<Intrinsic Name="bufSize" Expression="16 / sizeof($T1) &lt; 1 ? 1 : 16 / sizeof($T1)" />
10151013
<Intrinsic Name="isShortString" Expression="capacity() &lt; bufSize()" />
10161014
<Intrinsic Name="isLongString" Expression="capacity() &gt;= bufSize()" />
10171015
<DisplayString Condition="isShortString()">{_Mypair._Myval2._Bx._Buf,na}</DisplayString>
@@ -1030,85 +1028,14 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10301028
</Expand>
10311029
</Type>
10321030

1033-
<Type Name="std::basic_string&lt;wchar_t,*&gt;">
1034-
<AlternativeType Name="std::basic_string&lt;unsigned short,*&gt;" />
1035-
<AlternativeType Name="std::basic_string&lt;char16_t,*&gt;" />
1036-
1037-
<Intrinsic Name="size" Expression="_Mypair._Myval2._Mysize" />
1038-
<Intrinsic Name="capacity" Expression="_Mypair._Myval2._Myres" />
1039-
<!-- _BUF_SIZE = 16 / sizeof(wchar_t) &lt; 1 ? 1 : 16 / sizeof(wchar_t) == 8 -->
1040-
<Intrinsic Name="bufSize" Expression="8" />
1041-
<Intrinsic Name="isShortString" Expression="capacity() &lt; bufSize()" />
1042-
<Intrinsic Name="isLongString" Expression="capacity() &gt;= bufSize()" />
1043-
<DisplayString Condition="isShortString()">{_Mypair._Myval2._Bx._Buf,su}</DisplayString>
1044-
<DisplayString Condition="isLongString()">{_Mypair._Myval2._Bx._Ptr,su}</DisplayString>
1045-
<StringView Condition="isShortString()">_Mypair._Myval2._Bx._Buf,su</StringView>
1046-
<StringView Condition="isLongString()">_Mypair._Myval2._Bx._Ptr,su</StringView>
1047-
<Expand>
1048-
<Item Name="[size]" ExcludeView="simple">size()</Item>
1049-
<Item Name="[capacity]" ExcludeView="simple">capacity()</Item>
1050-
<Item Name="[allocator]" ExcludeView="simple">_Mypair</Item>
1051-
<ArrayItems>
1052-
<Size>_Mypair._Myval2._Mysize</Size>
1053-
<ValuePointer Condition="isShortString()">_Mypair._Myval2._Bx._Buf</ValuePointer>
1054-
<ValuePointer Condition="isLongString()">_Mypair._Myval2._Bx._Ptr</ValuePointer>
1055-
</ArrayItems>
1056-
</Expand>
1057-
</Type>
1058-
1059-
<Type Name="std::basic_string&lt;char32_t,*&gt;">
1060-
<Intrinsic Name="size" Expression="_Mypair._Myval2._Mysize" />
1061-
<Intrinsic Name="capacity" Expression="_Mypair._Myval2._Myres" />
1062-
<!-- _BUF_SIZE = 16 / sizeof(char32_t) &lt; 1 ? 1 : 16 / sizeof(char32_t) == 4 -->
1063-
<Intrinsic Name="bufSize" Expression="4" />
1064-
<Intrinsic Name="isShortString" Expression="capacity() &lt; bufSize()" />
1065-
<Intrinsic Name="isLongString" Expression="capacity() &gt;= bufSize()" />
1066-
<DisplayString Condition="isShortString()">{_Mypair._Myval2._Bx._Buf,s32}</DisplayString>
1067-
<DisplayString Condition="isLongString()">{_Mypair._Myval2._Bx._Ptr,s32}</DisplayString>
1068-
<StringView Condition="isShortString()">_Mypair._Myval2._Bx._Buf,s32</StringView>
1069-
<StringView Condition="isLongString()">_Mypair._Myval2._Bx._Ptr,s32</StringView>
1070-
<Expand>
1071-
<Item Name="[size]" ExcludeView="simple">size()</Item>
1072-
<Item Name="[capacity]" ExcludeView="simple">capacity()</Item>
1073-
<Item Name="[allocator]" ExcludeView="simple">_Mypair</Item>
1074-
<ArrayItems>
1075-
<Size>_Mypair._Myval2._Mysize</Size>
1076-
<ValuePointer Condition="isShortString()">_Mypair._Myval2._Bx._Buf</ValuePointer>
1077-
<ValuePointer Condition="isLongString()">_Mypair._Myval2._Bx._Ptr</ValuePointer>
1078-
</ArrayItems>
1079-
</Expand>
1080-
</Type>
1081-
1082-
<Type Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char&gt; &gt; &gt;">
1083-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char&gt; &gt; &gt;" />
1084-
<AlternativeType Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char8_t&gt; &gt; &gt;" />
1085-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char8_t&gt; &gt; &gt;" />
1031+
<Type Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;*&gt; &gt; &gt;">
1032+
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;*&gt; &gt; &gt;" />
10861033
<SmartPointer Usage="Indexable">_Ptr,na</SmartPointer>
10871034
<Expand>
10881035
<Item Name="[ptr]">_Ptr</Item>
10891036
</Expand>
10901037
</Type>
10911038

1092-
<Type Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;wchar_t&gt; &gt; &gt;">
1093-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;wchar_t&gt; &gt; &gt;" />
1094-
<AlternativeType Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;unsigned short&gt; &gt; &gt;" />
1095-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;unsigned short&gt; &gt; &gt;" />
1096-
<AlternativeType Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char16_t&gt; &gt; &gt;" />
1097-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char16_t&gt; &gt; &gt;" />
1098-
<SmartPointer Usage="Indexable">_Ptr,su</SmartPointer>
1099-
<Expand>
1100-
<Item Name="[ptr]">_Ptr</Item>
1101-
</Expand>
1102-
</Type>
1103-
1104-
<Type Name="std::_String_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char32_t&gt; &gt; &gt;">
1105-
<AlternativeType Name="std::_String_const_iterator&lt;std::_String_val&lt;std::_Simple_types&lt;char32_t&gt; &gt; &gt;" />
1106-
<SmartPointer Usage="Indexable">_Ptr,s32</SmartPointer>
1107-
<Expand>
1108-
<Item Name="[ptr]">_Ptr</Item>
1109-
</Expand>
1110-
</Type>
1111-
11121039
<Type Name="std::basic_string_view&lt;*,*&gt;">
11131040
<Intrinsic Name="size" Expression="_Mysize" />
11141041
<Intrinsic Name="data" Expression="_Mydata" />

0 commit comments

Comments
 (0)