Skip to content

Commit

Permalink
Visualise C++20 chrono additions (#1773)
Browse files Browse the repository at this point in the history
* Visualise C++20 chrono additions

* tabs are bad

* [skip ci] oops

* Apply suggestions from code review

Co-authored-by: Casey Carter <[email protected]>
Co-authored-by: statementreply <[email protected]>

* Put is_negative first and change display of hms

* Apply suggestions from code review

Co-authored-by: Stephan T. Lavavej <[email protected]>

Co-authored-by: Casey Carter <[email protected]>
Co-authored-by: statementreply <[email protected]>
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
4 people authored Apr 9, 2021
1 parent 318dcb3 commit 4ee3f91
Showing 1 changed file with 176 additions and 0 deletions.
176 changes: 176 additions & 0 deletions stl/debugger/STL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -673,35 +673,211 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception


<Type Name="std::chrono::duration&lt;*,std::ratio&lt;1,1000000000&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} nanosecond</DisplayString>
<DisplayString>{_MyRep} nanoseconds</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;1,1000000&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} microsecond</DisplayString>
<DisplayString>{_MyRep} microseconds</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;1,1000&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} millisecond</DisplayString>
<DisplayString>{_MyRep} milliseconds</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;1,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} second</DisplayString>
<DisplayString>{_MyRep} seconds</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;60,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} minute</DisplayString>
<DisplayString>{_MyRep} minutes</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;3600,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} hour</DisplayString>
<DisplayString>{_MyRep} hours</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;86400,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} day</DisplayString>
<DisplayString>{_MyRep} days</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;604800,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} week</DisplayString>
<DisplayString>{_MyRep} weeks</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;2629746,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} month</DisplayString>
<DisplayString>{_MyRep} months</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::duration&lt;*,std::ratio&lt;31556952,1&gt; &gt;">
<DisplayString Condition="_MyRep == 1">{_MyRep} year</DisplayString>
<DisplayString>{_MyRep} years</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::day">
<DisplayString Condition="_Day % 10 == 1 &amp;&amp; _Day % 100 != 11">{(int)_Day}st</DisplayString>
<DisplayString Condition="_Day % 10 == 2 &amp;&amp; _Day % 100 != 12">{(int)_Day}nd</DisplayString>
<DisplayString Condition="_Day % 10 == 3 &amp;&amp; _Day % 100 != 13">{(int)_Day}rd</DisplayString>
<DisplayString>{(int)_Day}th</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::month">
<DisplayString Condition="_Month == 1">January</DisplayString>
<DisplayString Condition="_Month == 2">February</DisplayString>
<DisplayString Condition="_Month == 3">March</DisplayString>
<DisplayString Condition="_Month == 4">April</DisplayString>
<DisplayString Condition="_Month == 5">May</DisplayString>
<DisplayString Condition="_Month == 6">June</DisplayString>
<DisplayString Condition="_Month == 7">July</DisplayString>
<DisplayString Condition="_Month == 8">August</DisplayString>
<DisplayString Condition="_Month == 9">September</DisplayString>
<DisplayString Condition="_Month == 10">October</DisplayString>
<DisplayString Condition="_Month == 11">November</DisplayString>
<DisplayString Condition="_Month == 12">December</DisplayString>
<DisplayString>{_Month}</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::year">
<DisplayString>{_Year}</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::weekday">
<DisplayString Condition="_Weekday == 0">Sunday</DisplayString>
<DisplayString Condition="_Weekday == 1">Monday</DisplayString>
<DisplayString Condition="_Weekday == 2">Tuesday</DisplayString>
<DisplayString Condition="_Weekday == 3">Wednesday</DisplayString>
<DisplayString Condition="_Weekday == 4">Thursday</DisplayString>
<DisplayString Condition="_Weekday == 5">Friday</DisplayString>
<DisplayString Condition="_Weekday == 6">Saturday</DisplayString>
<DisplayString>{_Weekday}</DisplayString>
<Expand/>
</Type>

<Type Name="std::chrono::weekday_indexed">
<DisplayString Condition="_Index == 1">{(int)_Index}st {_Weekday}</DisplayString>
<DisplayString Condition="_Index == 2">{(int)_Index}nd {_Weekday}</DisplayString>
<DisplayString Condition="_Index == 3">{(int)_Index}rd {_Weekday}</DisplayString>
<DisplayString Condition="_Index == 4 || _Index == 5">{(int)_Index}th {_Weekday}</DisplayString>
<DisplayString>{(int)_Index}, {_Weekday}</DisplayString>
<Expand>
<Item Name="[weekday]">_Weekday</Item>
<Item Name="[index]">(int)_Index</Item>
</Expand>
</Type>

<Type Name="std::chrono::weekday_last">
<DisplayString>Last {_Weekday}</DisplayString>
<Expand>
<Item Name="[weekday]">_Weekday</Item>
</Expand>
</Type>

<Type Name="std::chrono::month_day">
<DisplayString>{_Month} {_Day}</DisplayString>
<Expand>
<Item Name="[month]">_Month</Item>
<Item Name="[day]">_Day</Item>
</Expand>
</Type>

<Type Name="std::chrono::month_day_last">
<DisplayString>Last day of {_Month}</DisplayString>
<Expand>
<Item Name="[month]">_Month</Item>
</Expand>
</Type>

<Type Name="std::chrono::month_weekday">
<DisplayString>{_Weekday_index} of {_Month}</DisplayString>
<Expand>
<Item Name="[month]">_Month</Item>
<Item Name="[weekday_indexed]">_Weekday_index</Item>
</Expand>
</Type>

<Type Name="std::chrono::month_weekday_last">
<DisplayString>Last {_Weekday_last._Weekday} of {_Month}</DisplayString>
<Expand>
<Item Name="[month]">_Month</Item>
<Item Name="[weekday]">_Weekday_last._Weekday</Item>
</Expand>
</Type>

<Type Name="std::chrono::year_month">
<DisplayString>{_Year} {_Month}</DisplayString>
<Expand>
<Item Name="[year]">_Year</Item>
<Item Name="[month]">_Month</Item>
</Expand>
</Type>

<Type Name="std::chrono::year_month_day">
<DisplayString>{_Year} {_Month} {_Day}</DisplayString>
<Expand>
<Item Name="[year]">_Year</Item>
<Item Name="[month]">_Month</Item>
<Item Name="[day]">_Day</Item>
</Expand>
</Type>

<Type Name="std::chrono::year_month_day_last">
<DisplayString>{_Month_day_last}, {_Year}</DisplayString>
<Expand>
<Item Name="[year]">_Year</Item>
<Item Name="[month]">_Month_day_last._Month</Item>
</Expand>
</Type>

<Type Name="std::chrono::year_month_weekday">
<DisplayString>{_Weekday_index} of {_Month}, {_Year}</DisplayString>
<Expand>
<Item Name="[year]">_Year</Item>
<Item Name="[month]">_Month</Item>
<Item Name="[weekday_indexed]">_Weekday_index</Item>
</Expand>
</Type>

<Type Name="std::chrono::year_month_weekday_last">
<DisplayString>{_Weekday_last} of {_Month}, {_Year}</DisplayString>
<Expand>
<Item Name="[year]">_Year</Item>
<Item Name="[month]">_Month</Item>
<Item Name="[weekday]">_Weekday_last._Weekday</Item>
</Expand>
</Type>

<Type Name="std::chrono::hh_mm_ss&lt;*&gt;">
<DisplayString Condition="_Is_neg">-{_Hours._MyRep}h {_Mins._MyRep}m {_Secs._MyRep}s {_Sub_secs._MyRep}ss</DisplayString>
<DisplayString>{_Hours._MyRep}h {_Mins._MyRep}m {_Secs._MyRep}s {_Sub_secs._MyRep}ss</DisplayString>
<Expand>
<Item Name="[is_negative]">_Is_neg</Item>
<Item Name="[hours]">_Hours</Item>
<Item Name="[minutes]">_Mins</Item>
<Item Name="[seconds]">_Secs</Item>
<Item Name="[subseconds]">_Sub_secs</Item>
</Expand>
</Type>

<!-- VC 2013 -->
<Type Name="std::basic_string&lt;char,*&gt;" Priority="MediumLow">
Expand Down

0 comments on commit 4ee3f91

Please sign in to comment.