Teach the "extend char types" (char16_t, char32_t and wchar_t) formatters that a *single character* whose value is 0 is actually a valid thing to print out
llvm-svn: 242572
This commit is contained in:
parent
3db51cbc21
commit
8a1cedddd8
|
@ -362,6 +362,7 @@ lldb_private::formatters::Char16SummaryProvider (ValueObject& valobj, Stream& st
|
|||
options.SetPrefixToken('u');
|
||||
options.SetQuote('\'');
|
||||
options.SetSourceSize(1);
|
||||
options.SetBinaryZeroIsTerminator(false);
|
||||
|
||||
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
|
||||
}
|
||||
|
@ -387,6 +388,7 @@ lldb_private::formatters::Char32SummaryProvider (ValueObject& valobj, Stream& st
|
|||
options.SetPrefixToken('U');
|
||||
options.SetQuote('\'');
|
||||
options.SetSourceSize(1);
|
||||
options.SetBinaryZeroIsTerminator(false);
|
||||
|
||||
return ReadBufferAndDumpToStream<StringElementType::UTF32>(options);
|
||||
}
|
||||
|
@ -407,6 +409,7 @@ lldb_private::formatters::WCharSummaryProvider (ValueObject& valobj, Stream& str
|
|||
options.SetPrefixToken('L');
|
||||
options.SetQuote('\'');
|
||||
options.SetSourceSize(1);
|
||||
options.SetBinaryZeroIsTerminator(false);
|
||||
|
||||
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,12 @@ class Char1632TestCase(TestBase):
|
|||
self.expect("frame variable s16 s32",
|
||||
substrs = ['(char16_t *) s16 = 0x','(char32_t *) s32 = ','"色ハ匂ヘト散リヌルヲ"','"෴"'])
|
||||
|
||||
# check that zero values are properly handles
|
||||
self.expect('frame variable cs16_zero', substrs=["U+0000 u'\\0'"])
|
||||
self.expect('frame variable cs32_zero', substrs=["U+0x00000000 U'\\0'"])
|
||||
self.expect('expression cs16_zero', substrs=["U+0000 u'\\0'"])
|
||||
self.expect('expression cs32_zero', substrs=["U+0x00000000 U'\\0'"])
|
||||
|
||||
# Check that we can run expressions that return charN_t
|
||||
self.expect("expression u'a'",substrs = ['(char16_t) $',"61 u'a'"])
|
||||
self.expect("expression U'a'",substrs = ['(char32_t) $',"61 U'a'"])
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
int main (int argc, char const *argv[])
|
||||
{
|
||||
auto cs16_zero = (char16_t)0;
|
||||
auto cs32_zero = (char32_t)0;
|
||||
auto cs16 = u"hello world ྒྙྐ";
|
||||
auto cs32 = U"hello world ྒྙྐ";
|
||||
char16_t *s16 = (char16_t *)u"ﺸﺵۻ";
|
||||
|
|
|
@ -78,6 +78,9 @@ class CxxWCharTTestCase(TestBase):
|
|||
|
||||
self.expect("frame variable array",substrs = ['L"Hey, I\'m a super wchar_t string'])
|
||||
self.expect("frame variable array",substrs = ['[0]'], matching=False)
|
||||
|
||||
self.expect('frame variable wchar_zero', substrs=["L'\\0'"])
|
||||
self.expect('expression wchar_zero', substrs=["L'\\0'"])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import atexit
|
||||
|
|
|
@ -29,6 +29,7 @@ int main (int argc, char const *argv[])
|
|||
wchar_t *ws_NULL = nullptr;
|
||||
wchar_t *ws_empty = L"";
|
||||
wchar_t array[200], * array_source = L"Hey, I'm a super wchar_t string, éõñž";
|
||||
wchar_t wchar_zero = (wchar_t)0;
|
||||
memcpy(array, array_source, 39 * sizeof(wchar_t));
|
||||
return 0; // Set break point at this line.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue