[Lldb-commits] [PATCH] D136011: [lldb] Don't check environment default char signedness when creating clang type for "char"

Arthur Eubanks via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 14 21:10:48 PDT 2022


aeubanks created this revision.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

With -f(un)signed-char, the die corresponding to "char" may be the wrong DW_ATE_(un)signed_char. Ultimately we can determine whether a type is the unspecified signedness char by looking if its name is "char" (as opposed to "signed char"/"unsigned char").

Fixes #23443


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136011

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/commands/expression/char/TestExprsChar.py
  lldb/test/API/commands/expression/char/main.cpp


Index: lldb/test/API/commands/expression/char/main.cpp
===================================================================
--- lldb/test/API/commands/expression/char/main.cpp
+++ lldb/test/API/commands/expression/char/main.cpp
@@ -1,5 +1,7 @@
 #include <stdio.h>
 
+char g = 0;
+
 int foo(char c) { return 1; }
 int foo(signed char c) { return 2; }
 int foo(unsigned char c) { return 3; }
Index: lldb/test/API/commands/expression/char/TestExprsChar.py
===================================================================
--- lldb/test/API/commands/expression/char/TestExprsChar.py
+++ lldb/test/API/commands/expression/char/TestExprsChar.py
@@ -14,30 +14,13 @@
         self.expect_expr("foo(c)", result_value="1")
         self.expect_expr("foo(sc)", result_value="2")
         self.expect_expr("foo(uc)", result_value="3")
+        self.expect_expr("g", result_type="char")
 
     def test_default_char(self):
         self.do_test()
 
-    @skipIf(oslist=["linux"], archs=["aarch64", "arm"], bugnumber="llvm.org/pr23069")
-    @expectedFailureAll(
-        archs=[
-            "powerpc64le",
-            "s390x"],
-        bugnumber="llvm.org/pr23069")
     def test_signed_char(self):
         self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-    @expectedFailureAll(
-        archs=[
-            "i[3-6]86",
-            "x86_64",
-            "arm64",
-            'arm64e',
-            'armv7',
-            'armv7k',
-            'arm64_32'],
-        bugnumber="llvm.org/pr23069, <rdar://problem/28721938>")
-    @expectedFailureAll(triple='mips*', bugnumber="llvm.org/pr23069")
-    @expectedFailureAll(oslist=['windows'], archs=['aarch64'], bugnumber="llvm.org/pr23069")
     def test_unsigned_char(self):
         self.do_test(dictionary={'CFLAGS_EXTRAS': '-funsigned-char'})
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1063,7 +1063,7 @@
     break;
 
   case DW_ATE_signed_char:
-    if (ast.getLangOpts().CharIsSigned && type_name == "char") {
+    if (type_name == "char") {
       if (QualTypeMatchesBitSize(bit_size, ast, ast.CharTy))
         return GetType(ast.CharTy);
     }
@@ -1115,7 +1115,7 @@
     break;
 
   case DW_ATE_unsigned_char:
-    if (!ast.getLangOpts().CharIsSigned && type_name == "char") {
+    if (type_name == "char") {
       if (QualTypeMatchesBitSize(bit_size, ast, ast.CharTy))
         return GetType(ast.CharTy);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136011.467993.patch
Type: text/x-patch
Size: 2598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221015/f290a349/attachment.bin>


More information about the lldb-commits mailing list