Skip to content

Commit 222b885

Browse files
authored
Rollup merge of #76389 - MaulingMonkey:pr-natvis-hashmap-vsc, r=petrochenkov
Fix HashMap visualizers in Visual Studio (Code) CDB (as used in unit tests) doesn't care that we're using static_cast between unrelated types (`u8*` to `tuple<$T1, $T2>*`). Visual Studio & Visual Studio Code care. These should've been reinterpret_cast or C casts. Credit to @petrochenkov per #76352 for helping catch this. ### Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ```
2 parents b2ca513 + 5acd272 commit 222b885

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/etc/natvis/libstd.natvis

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
4242
<!-- Bucket is populated -->
4343
<Exec>n--</Exec>
44-
<Item Name="{static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__0}">static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__1</Item>
44+
<Item Name="{((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__0}">((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__1</Item>
4545
</If>
4646
<Exec>i++</Exec>
4747
</Loop>
@@ -65,7 +65,7 @@
6565
<If Condition="(map.base.table.ctrl.pointer[i] &amp; 0x80) == 0">
6666
<!-- Bucket is populated -->
6767
<Exec>n--</Exec>
68-
<Item>static_cast&lt;$T1*&gt;(map.base.table.ctrl.pointer)[-(i + 1)]</Item>
68+
<Item>(($T1*)map.base.table.ctrl.pointer)[-(i + 1)]</Item>
6969
</If>
7070
<Exec>i++</Exec>
7171
</Loop>

0 commit comments

Comments
 (0)