[LLDB] Fix crash when printing a struct with a static wchar_t member

Similar to D135170.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D135461
This commit is contained in:
Arthur Eubanks 2022-10-07 10:08:25 -07:00
parent 3d9f011a9c
commit eab5c2f94f
3 changed files with 9 additions and 0 deletions

View File

@ -1293,6 +1293,9 @@ void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
break; // no suffix.
case BuiltinType::UInt128:
break; // no suffix.
case BuiltinType::WChar_S:
case BuiltinType::WChar_U:
break; // no suffix
}
}

View File

@ -42,6 +42,7 @@ class TestCase(TestBase):
self.expect_expr("A::ulong_max == ulong_max", result_value="true")
self.expect_expr("A::longlong_max == longlong_max", result_value="true")
self.expect_expr("A::ulonglong_max == ulonglong_max", result_value="true")
self.expect_expr("A::wchar_max == wchar_max", result_value="true")
self.expect_expr("A::char_min == char_min", result_value="true")
self.expect_expr("A::schar_min == schar_min", result_value="true")
@ -52,6 +53,7 @@ class TestCase(TestBase):
self.expect_expr("A::ulong_min == ulong_min", result_value="true")
self.expect_expr("A::longlong_min == longlong_min", result_value="true")
self.expect_expr("A::ulonglong_min == ulonglong_min", result_value="true")
self.expect_expr("A::wchar_min == wchar_min", result_value="true")
# Test an unscoped enum.
self.expect_expr("A::enum_val", result_value="enum_case2")

View File

@ -36,6 +36,7 @@ struct A {
const static auto longlong_max = std::numeric_limits<long long>::max();
const static auto ulonglong_max =
std::numeric_limits<unsigned long long>::max();
const static auto wchar_max = std::numeric_limits<wchar_t>::max();
const static auto char_min = std::numeric_limits<char>::min();
const static auto schar_min = std::numeric_limits<signed char>::min();
@ -47,6 +48,7 @@ struct A {
const static auto longlong_min = std::numeric_limits<long long>::min();
const static auto ulonglong_min =
std::numeric_limits<unsigned long long>::min();
const static auto wchar_min = std::numeric_limits<wchar_t>::min();
const static Enum enum_val = enum_case2;
const static ScopedEnum scoped_enum_val = ScopedEnum::scoped_enum_case2;
@ -93,6 +95,7 @@ int main() {
auto ulong_max = A::ulong_max;
auto longlong_max = A::longlong_max;
auto ulonglong_max = A::ulonglong_max;
auto wchar_max = A::wchar_max;
auto char_min = A::char_min;
auto schar_min = A::schar_min;
@ -103,6 +106,7 @@ int main() {
auto ulong_min = A::ulong_min;
auto longlong_min = A::longlong_min;
auto ulonglong_min = A::ulonglong_min;
auto wchar_min = A::wchar_min;
int member_copy = ClassWithOnlyConstStatic::member;