Skip to content

Commit

Permalink
Rollup merge of #76389 - MaulingMonkey:pr-natvis-hashmap-vsc, r=petro…
Browse files Browse the repository at this point in the history
…chenkov

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
```
  • Loading branch information
Dylan-DPC authored Sep 8, 2020
2 parents b2ca513 + 5acd272 commit 222b885
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/etc/natvis/libstd.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
<!-- Bucket is populated -->
<Exec>n--</Exec>
<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>
<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>
</If>
<Exec>i++</Exec>
</Loop>
Expand All @@ -65,7 +65,7 @@
<If Condition="(map.base.table.ctrl.pointer[i] &amp; 0x80) == 0">
<!-- Bucket is populated -->
<Exec>n--</Exec>
<Item>static_cast&lt;$T1*&gt;(map.base.table.ctrl.pointer)[-(i + 1)]</Item>
<Item>(($T1*)map.base.table.ctrl.pointer)[-(i + 1)]</Item>
</If>
<Exec>i++</Exec>
</Loop>
Expand Down

0 comments on commit 222b885

Please sign in to comment.