[Lldb-commits] [lldb] ba8ded6 - [lldb] Don't check environment default char signedness when creating clang type for "char"
Arthur Eubanks via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 20 15:04:09 PDT 2022
Author: Arthur Eubanks
Date: 2022-10-20T15:03:36-07:00
New Revision: ba8ded6820fa610c7460fe86cd1f41f1df4bcc6c
URL: https://github.com/llvm/llvm-project/commit/ba8ded6820fa610c7460fe86cd1f41f1df4bcc6c
DIFF: https://github.com/llvm/llvm-project/commit/ba8ded6820fa610c7460fe86cd1f41f1df4bcc6c.diff
LOG: [lldb] Don't check environment default char signedness when creating clang type for "char"
With -f(un)signed-char, the die corresponding to "char" may be the opposite DW_ATE_(un)signed_char from the default platform signedness.
Ultimately we should determine whether a type is the unspecified signedness char by looking if its name is "char" (as opposed to "signed char"/"unsigned char") and not care about DW_ATE_(un)signed_char matching the platform default.
Fixes #23443
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D136011
Added:
Modified:
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/test/API/commands/expression/char/TestExprsChar.py
lldb/test/API/commands/expression/char/main.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 0185bf8f052d8..3ebd42c996bdc 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1063,7 +1063,7 @@ CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize(
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 @@ CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize(
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);
}
diff --git a/lldb/test/API/commands/expression/char/TestExprsChar.py b/lldb/test/API/commands/expression/char/TestExprsChar.py
index 849615ef91453..02a2e8c6d31a7 100644
--- a/lldb/test/API/commands/expression/char/TestExprsChar.py
+++ b/lldb/test/API/commands/expression/char/TestExprsChar.py
@@ -14,30 +14,15 @@ def do_test(self, dictionary=None):
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")
+ self.expect_expr("gs", result_type="signed char")
+ self.expect_expr("gu", result_type="unsigned 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'})
diff --git a/lldb/test/API/commands/expression/char/main.cpp b/lldb/test/API/commands/expression/char/main.cpp
index 9ff4436d88a08..23eb554e6ad66 100644
--- a/lldb/test/API/commands/expression/char/main.cpp
+++ b/lldb/test/API/commands/expression/char/main.cpp
@@ -1,5 +1,9 @@
#include <stdio.h>
+char g = 0;
+signed char gs = 0;
+unsigned char gu = 0;
+
int foo(char c) { return 1; }
int foo(signed char c) { return 2; }
int foo(unsigned char c) { return 3; }
More information about the lldb-commits
mailing list