Skip to content

Commit

Permalink
Update Abseil raw_flat_hash visualization (#18329)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->
Fix the broken pieces due to the latest   Abseil update.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
Make the debugging bearable.
  • Loading branch information
yuslepukhin authored Nov 8, 2023
1 parent a0eeeaf commit a37e6a5
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions cmake/external/abseil-cpp.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,56 @@
</Type>
<!-- Should handle both flat hash_set and hash_map -->
<Type Name="absl::lts_20230802::container_internal::raw_hash_set&lt;*&gt;">
<DisplayString Condition="size_ == 0">empty</DisplayString>
<DisplayString>{{ size={size_} }}</DisplayString>
<Intrinsic Name="_commonfields" Expression="settings_.value"/>
<Intrinsic Name="_size" Expression="settings_.value.compressed_tuple_.value"/>
<Intrinsic Name="_capacity" Expression="_commonfields().capacity_"/>
<Intrinsic Name="_control" Expression="_commonfields().control_"/>
<Intrinsic Name="_slots" Expression="(slot_type*)(_commonfields().slots_)"/>
<DisplayString Condition="_size() == 0">empty</DisplayString>
<DisplayString IncludeView="noparens">size={ _size() }</DisplayString>
<DisplayString ExcludeView="noparens">size=({_size()})</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">size_</Item>
<Item Name="[capacity]" ExcludeView="simple">capacity_</Item>
<CustomListItems MaxItemsPerView="5000">
<Item Name="[Size]">_size()</Item>
<Item Name="[Capacity]" ExcludeView="noparens">_capacity()</Item>
<CustomListItems MaxItemsPerView="100">
<Variable Name="nslot" InitialValue="0" />
<Size>size_</Size>
<Size>_size()</Size>
<Loop>
<!-- bool IsFull(ctrl_t c) const { return c >= 0; } -->
<If Condition="ctrl_[nslot] &gt;= 0">
<Item>slots_[nslot]</Item>
<If Condition="_control()[nslot] &gt;= 0">
<Item>_slots()[nslot]</Item>
</If>
<Exec>nslot++</Exec>
<Break Condition="nslot == capacity_" />
<Break Condition="nslot == _capacity()" />
</Loop>
</CustomListItems>
</Expand>
</Type>

<!-- Primitive types stored as a value -->
<Type Name="absl::lts_20230802::container_internal::Storage&lt;*,*,0&gt;">
<DisplayString IncludeView="noparens">*($T1 *){value}</DisplayString>
<DisplayString ExcludeView="noparens">(*($T1 *){value})</DisplayString>
<Expand>
<ExpandedItem>*($T1 *){value}</ExpandedItem>
</Expand>
</Type>

<!-- For storage inherited from the type -->
<Type Name="absl::lts_20230802::container_internal::Storage&lt;*,*,1&gt;">
<DisplayString IncludeView="noparens">*($T1 *)this</DisplayString>
<DisplayString ExcludeView="noparens">(*($T1 *)this)</DisplayString>
<Expand>
<ExpandedItem>*($T1 *)this</ExpandedItem>
</Expand>
</Type>

<Type Name="absl::lts_20230802::container_internal::map_slot_type&lt;*&gt;">
<DisplayString>{{ {value.first}:{value.second} }}</DisplayString>
<DisplayString IncludeView="noparens">{value.first}, {value.second}</DisplayString>
<DisplayString ExcludeView="noparens">({value.first}, {value.second})</DisplayString>
<Expand>
<Item Name="[key]" ExcludeView="simple">value.first</Item>
<Item Name="[value]" ExcludeView="simple">value.second</Item>
<Item Name="first" ExcludeView="simple">value.first</Item>
<Item Name="second" ExcludeView="simple">value.second</Item>
</Expand>
</Type>
</AutoVisualizer>

0 comments on commit a37e6a5

Please sign in to comment.