mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Fix debugger visualizer for Ext=gsl::dynamic_extent
VS 2019 doesn't seem to match -1 for size_t template parameter, as a result dynamic span/basic_string_span/basic_zstring_span show extent as `extent = 4294967295` (for 32-bit builds). This change updates details::extent_type to have static constexpr size_ parameter for non-dynamic span/basic_string_span/basic_zstring_span and simplifies/removes dynamic versions from GSL.natvis fixes #856
This commit is contained in:
parent
226a854a97
commit
830b081de7
47
GSL.natvis
47
GSL.natvis
@ -19,9 +19,7 @@
|
|||||||
</Expand>
|
</Expand>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
||||||
<!-- These types are from the span header. -->
|
<Type Name="gsl::span<*, *>">
|
||||||
<!-- This is for dynamic_extent spans. -->
|
|
||||||
<Type Name="gsl::span<*, -1>">
|
|
||||||
<DisplayString>{{ extent = {storage_.size_} }}</DisplayString>
|
<DisplayString>{{ extent = {storage_.size_} }}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<ArrayItems>
|
<ArrayItems>
|
||||||
@ -31,43 +29,7 @@
|
|||||||
</Expand>
|
</Expand>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
||||||
<!-- This works for constexpr size spans. -->
|
|
||||||
<Type Name="gsl::span<*, *>">
|
|
||||||
<DisplayString>{{ extent = {extent} }}</DisplayString>
|
|
||||||
<Expand>
|
|
||||||
<ArrayItems>
|
|
||||||
<Size>extent</Size>
|
|
||||||
<ValuePointer>storage_.data_</ValuePointer>
|
|
||||||
</ArrayItems>
|
|
||||||
</Expand>
|
|
||||||
</Type>
|
|
||||||
|
|
||||||
<!-- This is for dynamic_extent string_spans. -->
|
|
||||||
<Type Name="gsl::basic_string_span<*, -1>">
|
|
||||||
<DisplayString>{span_.storage_.data_,[span_.storage_.size_]na}</DisplayString>
|
|
||||||
<Expand>
|
|
||||||
<Item Name="[size]">span_.storage_.size_</Item>
|
|
||||||
<ArrayItems>
|
|
||||||
<Size>span_.storage_.size_</Size>
|
|
||||||
<ValuePointer>span_.storage_.data_</ValuePointer>
|
|
||||||
</ArrayItems>
|
|
||||||
</Expand>
|
|
||||||
</Type>
|
|
||||||
|
|
||||||
<!-- This works for constexpr size string_spans. -->
|
|
||||||
<Type Name="gsl::basic_string_span<*, *>">
|
<Type Name="gsl::basic_string_span<*, *>">
|
||||||
<DisplayString>{span_.storage_.data_,[span_.extent]na}</DisplayString>
|
|
||||||
<Expand>
|
|
||||||
<Item Name="[size]">span_.extent</Item>
|
|
||||||
<ArrayItems>
|
|
||||||
<Size>span_.extent</Size>
|
|
||||||
<ValuePointer>span_.storage_.data_</ValuePointer>
|
|
||||||
</ArrayItems>
|
|
||||||
</Expand>
|
|
||||||
</Type>
|
|
||||||
|
|
||||||
<!-- This is for dynamic_extent zstring_spans. -->
|
|
||||||
<Type Name="gsl::basic_zstring_span<*, -1>">
|
|
||||||
<DisplayString>{span_.storage_.data_,[span_.storage_.size_]na}</DisplayString>
|
<DisplayString>{span_.storage_.data_,[span_.storage_.size_]na}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<Item Name="[size]">span_.storage_.size_</Item>
|
<Item Name="[size]">span_.storage_.size_</Item>
|
||||||
@ -78,13 +40,12 @@
|
|||||||
</Expand>
|
</Expand>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
||||||
<!-- This works for constexpr size string_spans. -->
|
|
||||||
<Type Name="gsl::basic_zstring_span<*, *>">
|
<Type Name="gsl::basic_zstring_span<*, *>">
|
||||||
<DisplayString>{span_.storage_.data_,[span_.extent]na}</DisplayString>
|
<DisplayString>{span_.storage_.data_,[span_.storage_.size_]na}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<Item Name="[size]">span_.extent</Item>
|
<Item Name="[size]">span_.storage_.size_</Item>
|
||||||
<ArrayItems>
|
<ArrayItems>
|
||||||
<Size>span_.extent</Size>
|
<Size>span_.storage_.size_</Size>
|
||||||
<ValuePointer>span_.storage_.data_</ValuePointer>
|
<ValuePointer>span_.storage_.data_</ValuePointer>
|
||||||
</ArrayItems>
|
</ArrayItems>
|
||||||
</Expand>
|
</Expand>
|
||||||
|
@ -355,6 +355,13 @@ namespace details
|
|||||||
constexpr extent_type(size_type size) { Expects(size == Ext); }
|
constexpr extent_type(size_type size) { Expects(size == Ext); }
|
||||||
|
|
||||||
constexpr size_type size() const noexcept { return Ext; }
|
constexpr size_type size() const noexcept { return Ext; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
#if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)
|
||||||
|
static constexpr const size_type size_ = Ext; // static size equal to Ext
|
||||||
|
#else
|
||||||
|
static constexpr size_type size_ = Ext; // static size equal to Ext
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
Loading…
Reference in New Issue
Block a user