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

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 11:05:49 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGeab5c2f94f5a: [LLDB] Fix crash when printing a struct with a static wchar_t member (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135461/new/

https://reviews.llvm.org/D135461

Files:
  clang/lib/AST/StmtPrinter.cpp
  lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
  lldb/test/API/lang/cpp/const_static_integral_member/main.cpp


Index: lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
===================================================================
--- lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
+++ lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
@@ -36,6 +36,7 @@
   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 @@
   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 @@
   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 @@
   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;
 
Index: lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
===================================================================
--- lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -42,6 +42,7 @@
         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 @@
         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")
Index: clang/lib/AST/StmtPrinter.cpp
===================================================================
--- clang/lib/AST/StmtPrinter.cpp
+++ clang/lib/AST/StmtPrinter.cpp
@@ -1293,6 +1293,9 @@
     break; // no suffix.
   case BuiltinType::UInt128:
     break; // no suffix.
+  case BuiltinType::WChar_S:
+  case BuiltinType::WChar_U:
+    break; // no suffix
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135461.466868.patch
Type: text/x-patch
Size: 3143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221011/10d6f419/attachment-0001.bin>


More information about the cfe-commits mailing list