Skip to content

Commit 8f70daf

Browse files
author
git apple-llvm automerger
committed
Merge commit '648b3aab4788' from llvm.org/main into next
2 parents b8b18af + 648b3aa commit 8f70daf

File tree

2 files changed

+133
-3
lines changed

2 files changed

+133
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,14 +2144,17 @@ TypeSP SymbolFileNativePDB::CreateTypedef(PdbGlobalSymId id) {
21442144
if (!ts)
21452145
return nullptr;
21462146

2147-
ts->GetNativePDBParser()->GetOrCreateTypedefDecl(id);
2147+
auto *typedef_decl = ts->GetNativePDBParser()->GetOrCreateTypedefDecl(id);
2148+
2149+
CompilerType ct = target_type->GetForwardCompilerType();
2150+
if (auto *clang = llvm::dyn_cast_or_null<TypeSystemClang>(ts.get()))
2151+
ct = clang->GetType(clang->getASTContext().getTypeDeclType(typedef_decl));
21482152

21492153
Declaration decl;
21502154
return MakeType(toOpaqueUid(id), ConstString(udt.Name),
21512155
llvm::expectedToOptional(target_type->GetByteSize(nullptr)),
21522156
nullptr, target_type->GetID(),
2153-
lldb_private::Type::eEncodingIsTypedefUID, decl,
2154-
target_type->GetForwardCompilerType(),
2157+
lldb_private::Type::eEncodingIsTypedefUID, decl, ct,
21552158
lldb_private::Type::ResolveState::Forward);
21562159
}
21572160

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// REQUIRES: lld
2+
3+
// Test that simple types can be found
4+
// RUN: %build --std=c++20 --nodefaultlib --compiler=clang-cl --arch=64 -o %t.exe -- %s
5+
// RUN: lldb-test symbols %t.exe | FileCheck %s
6+
// RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=FUNC-PARAMS %s
7+
8+
bool *PB;
9+
bool &RB = *PB;
10+
bool *&RPB = PB;
11+
const bool &CRB = RB;
12+
bool *const BC = 0;
13+
const bool *const CBC = 0;
14+
15+
long AL[2];
16+
17+
const volatile short CVS = 0;
18+
const short CS = 0;
19+
volatile short VS;
20+
21+
struct ReturnedStruct1 {};
22+
struct ReturnedStruct2 {};
23+
24+
struct MyStruct {
25+
static ReturnedStruct1 static_fn(char *) { return {}; }
26+
ReturnedStruct2 const_member_fn(char *) const { return {}; }
27+
void volatile_member_fn() volatile {};
28+
void member_fn() {};
29+
};
30+
31+
void (*PF)(int, bool *, const float, double, ...);
32+
33+
using Func = void(char16_t, MyStruct &);
34+
Func *PF2;
35+
36+
using SomeTypedef = long;
37+
SomeTypedef ST;
38+
39+
int main() {
40+
bool b;
41+
char c;
42+
unsigned char uc;
43+
char8_t c8;
44+
45+
short s;
46+
unsigned short us;
47+
wchar_t wc;
48+
char16_t c16;
49+
50+
int i;
51+
unsigned int ui;
52+
long l;
53+
unsigned long ul;
54+
char32_t c32;
55+
56+
long long ll;
57+
unsigned long long ull;
58+
59+
MyStruct my_struct;
60+
61+
decltype(nullptr) np;
62+
}
63+
64+
// CHECK-DAG: Type{{.*}} , name = "std::nullptr_t", size = 0, compiler_type = 0x{{[0-9a-f]+}} nullptr_t
65+
66+
// CHECK-DAG: Type{{.*}} , name = "bool", size = 1, compiler_type = 0x{{[0-9a-f]+}} _Bool
67+
// CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = 0x{{[0-9a-f]+}} char
68+
// CHECK-DAG: Type{{.*}} , name = "unsigned char", size = 1, compiler_type = 0x{{[0-9a-f]+}} unsigned char
69+
// CHECK-DAG: Type{{.*}} , name = "char8_t", size = 1, compiler_type = 0x{{[0-9a-f]+}} char8_t
70+
71+
// CHECK-DAG: Type{{.*}} , size = 2, compiler_type = 0x{{[0-9a-f]+}} short
72+
// CHECK-DAG: Type{{.*}} , name = "const volatile ", size = 2, compiler_type = 0x{{[0-9a-f]+}} const volatile short
73+
// CHECK-DAG: Type{{.*}} , name = "const ", size = 2, compiler_type = 0x{{[0-9a-f]+}} const short
74+
// CHECK-DAG: Type{{.*}} , name = "volatile ", size = 2, compiler_type = 0x{{[0-9a-f]+}} volatile short
75+
76+
// CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = 0x{{[0-9a-f]+}} unsigned short
77+
// CHECK-DAG: Type{{.*}} , name = "wchar_t", size = 2, compiler_type = 0x{{[0-9a-f]+}} wchar_t
78+
// CHECK-DAG: Type{{.*}} , name = "char16_t", size = 2, compiler_type = 0x{{[0-9a-f]+}} char16_t
79+
80+
// CHECK-DAG: Type{{.*}} , name = "int", size = 4, compiler_type = 0x{{[0-9a-f]+}} int
81+
// CHECK-DAG: Type{{.*}} , name = "unsigned", size = 4, compiler_type = 0x{{[0-9a-f]+}} unsigned int
82+
// CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = 0x{{[0-9a-f]+}} long
83+
// CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = 0x{{[0-9a-f]+}} unsigned long
84+
// CHECK-DAG: Type{{.*}} , name = "char32_t", size = 4, compiler_type = 0x{{[0-9a-f]+}} char32_t
85+
86+
// CHECK-DAG: Type{{.*}} , name = "int64_t", size = 8, compiler_type = 0x{{[0-9a-f]+}} long long
87+
// CHECK-DAG: Type{{.*}} , name = "uint64_t", size = 8, compiler_type = 0x{{[0-9a-f]+}} unsigned long long
88+
89+
// CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = 0x{{[0-9a-f]+}} float
90+
// CHECK-DAG: Type{{.*}} , name = "const float", size = 4, compiler_type = 0x{{[0-9a-f]+}} const float
91+
92+
// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct1", size = 1, decl = simple-types.cpp:21, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct1 {
93+
// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct2", size = 1, decl = simple-types.cpp:22, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct2 {
94+
// CHECK-DAG: Type{{.*}} , name = "MyStruct", size = 1, decl = simple-types.cpp:24, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct {
95+
96+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct *const
97+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} const struct MyStruct *const
98+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} volatile struct MyStruct *const
99+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct &
100+
101+
// CHECK-DAG: Type{{.*}} , name = "const bool", size = 1, compiler_type = 0x{{[0-9a-f]+}} const _Bool
102+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} _Bool &
103+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} _Bool *
104+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} _Bool *&
105+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} const _Bool &
106+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} _Bool *const
107+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} const _Bool *const
108+
109+
// CHECK-DAG: Type{{.*}} , name = "SomeTypedef", size = 4, compiler_type = 0x{{[0-9a-f]+}} typedef SomeTypedef
110+
// CHECK-DAG: Type{{.*}} , name = "Func", size = 0, compiler_type = 0x{{[0-9a-f]+}} typedef Func
111+
112+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} int (void)
113+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} void (void)
114+
115+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} void (int, _Bool *, const float, double, ...)
116+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} void (*)(int, _Bool *, const float, double, ...)
117+
118+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} void (char16_t, struct MyStruct &)
119+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} void (*)(char16_t, struct MyStruct &)
120+
121+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct1 (char *)
122+
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct2 (char *)
123+
124+
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} long[2]
125+
126+
// double is used as a parameter to `PF`, but not created as an LLDB type
127+
// FUNC-PARAMS-NOT: Type{{.*}} , name = "double"

0 commit comments

Comments
 (0)