You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
an unrelated debugger issue, maybe you can pass it on internally within VS team:
(things like wchat_t{} aren't handled properly, while wchar_t() is ok)
Yes, that's irrelevant for this PR. Here's simplified visualizers for std::string
Not sure if that should be merged though, as it doesn't fix anything, but perhaps could break some versions of VS.
FYI, this PR works with all char types except with unsigned short. To make it work, separate overload for <Type Name="std::basic_string_view<unsigned short,*>"> needs to be added. Note, this is actually needed only when wchar_t is native! If it's not native (eg /Zc:wchar_t- is set in project options), then unsigned short works without any issues without extra overload. There is however, an issue with string_view::iterator for unsigned short: it uses traits as a template param, so not clear what's the best way to provide overload for the case (should perhaps use std::type_traits<unsigned short> there)
One other issue: string_view::iterator doesn't look like string::iterator in debugger. This also needs to be addressed.
FYI, this PR works with all char types except with unsigned short. To make it work, separate overload for <Type Name="std::basic_string_view<unsigned short,*>"> needs to be added. Note, this is actually needed only when wchar_t is native! If it's not native (eg /Zc:wchar_t- is set in project options), then unsigned short works without any issues without extra overload. There is however, an issue with string_view::iterator for unsigned short: it uses traits as a template param, so not clear what's the best way to provide overload for the case (should perhaps use std::type_traits<unsigned short> there)
We only care that basic_string<unsigned short> and basic_string_view<unsigned short> and their iterators visualize correctly with /Zc:wchar_t-. With /Zc:wchar_t-, they should like a lot like basic_string<wchar_t> et al. do with /Zc:wchar_t. Since this PR only adds some address suppression via na format specifiers, I don't think it should have regressed the visualization of any meow<unsigned short> types.
One other issue: string_view::iterator doesn't look like string::iterator in debugger. This also needs to be addressed.
I see, it looks like we're missing some ,na in the SmartPointer elements of the _String_view_iterator visualizers. That change is consistent with the intent of this PR, I think it should happen here.
Let me know is I should override this PR with that diff.
In short, it works for all types and matches DisplayString or StringView for string_view and string_view::iterator.
I used this code to test. Note, the test code has weird stuff like const short and others: I simply wanted to see how it would look like, but didn't try to make it work with those types.
sizeof(meow) == 2 seems problematic; programs can define custom character types of size 2 that have nothing to do with UTF-16. Why reintroduce su formatting if it's unnecessary for basic_string<wchar_t> and basic_string_view<wchar_t> with /Zc:wchar_t-?.
template<class T>
void testIter(T x)
{
auto s = x.substr(2, 10);
std::basic_string<std::remove_cv_t<typename T::value_type>> ss(s.data(), s.size());
typename T::iterator it = s.begin() + 1;
typename T::const_iterator itc = s.begin() + 1;
typename std::basic_string<std::remove_cv_t<typename T::value_type>>::iterator sit = ss.begin() + 1;
typename std::basic_string<std::remove_cv_t<typename T::value_type>>::const_iterator sitc = ss.begin() + 1;
s.empty();
}
void build_schema(const char* slnFile)
{
std::string s{"cute fluffy kittens \U0001F408"};
std::string_view sv{"a long \U0001F408 long cats"};
std::u8string_view sv8{u8"a long \U0001F408 long cats"};
std::wstring_view svw{L"a long \U0001F408 long cats"};
std::u16string_view sv16{u"a long \U0001F408 long cats"};
std::u32string_view sv32{U"a long \U0001F408 long cats"};
testIter(sv);
testIter(sv8);
testIter(svw);
testIter(sv16);
testIter(sv32);
}
All visualizers for string/string_view (using char, char8_t, char16_t, char32_t, wchar_t) and their iterators now look consistent. With /Zc:wchar_t- or without it. With _ITERATOR_DEBUG_LEVEL=0 or without it. (minor diff being that _ITERATOR_DEBUG_LEVEL=0 eliminates size from string_view::iterator).
This is sample debugger view for wchar_t with /Zc:wchar_t- (as you can see it shows up as unsigned short overload on the right.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
std::string_view
should be shown similar tostd::string
in debugger for basic view.