[PDB] Handle `char` as a builtin type

Summary:
`char`, `signed char` and `unsigned char` are three different types,
and they are mangled differently:

```
void __declspec(dllexport) /* ?foo@@YAXD@Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE@Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC@Z */ foo(signed char c) { }
```

This commit separates `char` from `signed char` and `unsigned char`.

Reviewers: asmith, zturner, labath

Reviewed By: asmith, zturner

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D52468

llvm-svn: 343298
This commit is contained in:
Aleksandr Urakov 2018-09-28 07:59:49 +00:00
parent 69bfa40200
commit ec97b523be
5 changed files with 10 additions and 4 deletions

View File

@ -35,6 +35,9 @@ EnumClass EnumClassVar;
enum struct EnumStruct { red, blue, black }; enum struct EnumStruct { red, blue, black };
EnumStruct EnumStructVar; EnumStruct EnumStructVar;
typedef signed char SCharTypedef;
SCharTypedef SCVar;
typedef char16_t WChar16Typedef; typedef char16_t WChar16Typedef;
WChar16Typedef WC16Var; WChar16Typedef WC16Var;

View File

@ -58,7 +58,7 @@ INNER: namespace N0 {
INNER: namespace N1 { INNER: namespace N1 {
INNER: class Class : public N0::N1::Base { INNER: class Class : public N0::N1::Base {
INNER: struct Inner { INNER: struct Inner {
INNER: signed char x; INNER: char x;
INNER: short y; INNER: short y;
INNER: int z; INNER: int z;
INNER: }; INNER: };

View File

@ -14,7 +14,7 @@ CHECK-ONE-DAG: [[TY0:.*]]: Type{[[UID0:.*]]} , name = "Func_arg_array", decl =
CHECK-ONE-DAG: [[TY1:.*]]: Type{[[UID1:.*]]} , name = "Func_arg_void", decl = FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY1:.*]]: Type{[[UID1:.*]]} , name = "Func_arg_void", decl = FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void)
CHECK-ONE-DAG: [[TY2:.*]]: Type{[[UID2:.*]]} , name = "Func_arg_none", decl = FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY2:.*]]: Type{[[UID2:.*]]} , name = "Func_arg_none", decl = FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void)
CHECK-ONE-DAG: [[TY3:.*]]: Type{[[UID3:.*]]} , name = "Func_varargs", decl = FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...) CHECK-ONE-DAG: [[TY3:.*]]: Type{[[UID3:.*]]} , name = "Func_varargs", decl = FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...)
CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (signed char, int) CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (char, int)
CHECK-ONE-DAG: [[TY5:.*]]: Type{[[UID5:.*]]} , name = "main", decl = FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void) CHECK-ONE-DAG: [[TY5:.*]]: Type{[[UID5:.*]]} , name = "main", decl = FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void)
CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...) CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...)
CHECK-ONE-DAG: [[TY7:.*]]: Type{[[UID7:.*]]} , name = "StaticFunction", decl = FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int) CHECK-ONE-DAG: [[TY7:.*]]: Type{[[UID7:.*]]} , name = "StaticFunction", decl = FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int)

View File

@ -46,9 +46,10 @@ CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} void *
CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long
CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = {{.*}} unsigned short CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = {{.*}} unsigned short
CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = {{.*}} unsigned int CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = {{.*}} unsigned int
CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = {{.*}} char
CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} signed char CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} signed char
CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} signed char (void *, long, unsigned short, unsigned int, ...) CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} char (void *, long, unsigned short, unsigned int, ...)
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} signed char (*)(void *, long, unsigned short, unsigned int, ...) CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} char (*)(void *, long, unsigned short, unsigned int, ...)
CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedef", compiler_type = {{.*}} typedef VarArgsFuncTypedef CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedef", compiler_type = {{.*}} typedef VarArgsFuncTypedef
CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float

View File

@ -113,6 +113,8 @@ GetBuiltinTypeForPDBEncodingAndBitSize(ClangASTContext &clang_ast,
return CompilerType(); return CompilerType();
case PDB_BuiltinType::Void: case PDB_BuiltinType::Void:
return clang_ast.GetBasicType(eBasicTypeVoid); return clang_ast.GetBasicType(eBasicTypeVoid);
case PDB_BuiltinType::Char:
return clang_ast.GetBasicType(eBasicTypeChar);
case PDB_BuiltinType::Bool: case PDB_BuiltinType::Bool:
return clang_ast.GetBasicType(eBasicTypeBool); return clang_ast.GetBasicType(eBasicTypeBool);
case PDB_BuiltinType::Long: case PDB_BuiltinType::Long: