[Lldb-commits] [lldb] r343298 - [PDB] Handle `char` as a builtin type

Aleksandr Urakov via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 28 00:59:49 PDT 2018


Author: aleksandr.urakov
Date: Fri Sep 28 00:59:49 2018
New Revision: 343298

URL: http://llvm.org/viewvc/llvm-project?rev=343298&view=rev
Log:
[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 at Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE at Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC at 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

Modified:
    lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
    lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
    lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
    lldb/trunk/lit/SymbolFile/PDB/typedefs.test
    lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Modified: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp?rev=343298&r1=343297&r2=343298&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp Fri Sep 28 00:59:49 2018
@@ -35,6 +35,9 @@ EnumClass EnumClassVar;
 enum struct EnumStruct { red, blue, black };
 EnumStruct EnumStructVar;
 
+typedef signed char SCharTypedef;
+SCharTypedef SCVar;
+
 typedef char16_t WChar16Typedef;
 WChar16Typedef WC16Var;
 

Modified: lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/ast-restore.test?rev=343298&r1=343297&r2=343298&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/PDB/ast-restore.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/ast-restore.test Fri Sep 28 00:59:49 2018
@@ -58,7 +58,7 @@ INNER: namespace N0 {
 INNER:     namespace N1 {
 INNER:         class Class : public N0::N1::Base {
 INNER:             struct Inner {
-INNER:                 signed char x;
+INNER:                 char x;
 INNER:                 short y;
 INNER:                 int z;
 INNER:             };

Modified: lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/func-symbols.test?rev=343298&r1=343297&r2=343298&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/PDB/func-symbols.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/func-symbols.test Fri Sep 28 00:59:49 2018
@@ -14,7 +14,7 @@ CHECK-ONE-DAG: [[TY0:.*]]:   Type{[[UID0
 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: [[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: [[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)

Modified: lldb/trunk/lit/SymbolFile/PDB/typedefs.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/typedefs.test?rev=343298&r1=343297&r2=343298&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/PDB/typedefs.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/typedefs.test Fri Sep 28 00:59:49 2018
@@ -46,9 +46,10 @@ CHECK-DAG: Type{{.*}} , size = 4, compil
 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 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{{.*}} , compiler_type = {{.*}} signed 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{{.*}} , compiler_type = {{.*}} 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 = "float", size = 4, compiler_type = {{.*}} float

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=343298&r1=343297&r2=343298&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Fri Sep 28 00:59:49 2018
@@ -113,6 +113,8 @@ GetBuiltinTypeForPDBEncodingAndBitSize(C
     return CompilerType();
   case PDB_BuiltinType::Void:
     return clang_ast.GetBasicType(eBasicTypeVoid);
+  case PDB_BuiltinType::Char:
+    return clang_ast.GetBasicType(eBasicTypeChar);
   case PDB_BuiltinType::Bool:
     return clang_ast.GetBasicType(eBasicTypeBool);
   case PDB_BuiltinType::Long:




More information about the lldb-commits mailing list