Skip to content

Commit 8d9993b

Browse files
committed
[LLDB][NativePDB] Add modifiers to modified type name
1 parent 24b5867 commit 8d9993b

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,18 @@ lldb::TypeSP SymbolFileNativePDB::CreateModifierType(PdbTypeSymId type_id,
549549
TpiStream &stream = m_index->tpi();
550550

551551
std::string name;
552+
553+
if ((mr.Modifiers & ModifierOptions::Const) != ModifierOptions::None)
554+
name += "const ";
555+
if ((mr.Modifiers & ModifierOptions::Volatile) != ModifierOptions::None)
556+
name += "volatile ";
557+
if ((mr.Modifiers & ModifierOptions::Unaligned) != ModifierOptions::None)
558+
name += "__unaligned ";
559+
552560
if (mr.ModifiedType.isSimple())
553-
name = std::string(GetSimpleTypeName(mr.ModifiedType.getSimpleKind()));
561+
name += GetSimpleTypeName(mr.ModifiedType.getSimpleKind());
554562
else
555-
name = computeTypeName(stream.typeCollection(), mr.ModifiedType);
563+
name += computeTypeName(stream.typeCollection(), mr.ModifiedType);
556564
Declaration decl;
557565
lldb::TypeSP modified_type = GetOrCreateType(mr.ModifiedType);
558566

lldb/test/Shell/SymbolFile/PDB/type-quals.test

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@ REQUIRES: target-windows, msvc
22
RUN: mkdir -p %t.dir
33
RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%t.dir/TypeQualsTest.cpp.obj %S/Inputs/TypeQualsTest.cpp
44
RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%t.dir/TypeQualsTest.cpp.exe %t.dir/TypeQualsTest.cpp.obj
5-
RUN: lldb-test symbols %t.dir/TypeQualsTest.cpp.exe | FileCheck %s
5+
RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/TypeQualsTest.cpp.exe | FileCheck %s
6+
RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/TypeQualsTest.cpp.exe | FileCheck %s
67

78
CHECK: Module [[MOD:.*]]
8-
CHECK-DAG: SymbolFile pdb ([[MOD]])
9+
CHECK-DAG: SymbolFile {{(native-)?}}pdb ([[MOD]])
910
CHECK-DAG: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int
1011
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *
1112
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const
1213
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const
1314
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const *
14-
CHECK-DAG: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *)
15+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *)
1516

1617
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int *
17-
CHECK-DAG: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *)
18+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *)
1819

1920
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *
2021
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *&
2122
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &&
2223
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &
2324
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int &
24-
CHECK-DAG: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&)
25+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&)
2526

2627
// FIXME: __unaligned is not supported.
27-
CHECK-DAG: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *)
28+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (int *, int *)
2829

2930
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict
3031
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict
31-
CHECK-DAG: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict)
32+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict)
3233

33-
CHECK-DAG: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict)
34+
CHECK-DAG: Type{{.*}} , name = "{{volatile const|const volatile}} int", size = 4, compiler_type = {{.*}} {{volatile const|const volatile}} int
35+
CHECK-DAG: Type{{.*}} , {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict)
3436

3537
CHECK-DAG: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100]
3638
CHECK-DAG: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100]

0 commit comments

Comments
 (0)