Skip to content

Commit 1dbde10

Browse files
committed
refactor: convert test to use split-file
1 parent 288b5f7 commit 1dbde10

File tree

3 files changed

+135
-132
lines changed

3 files changed

+135
-132
lines changed

lldb/test/Shell/SymbolFile/NativePDB/Inputs/namespace-access.lldbinit

Lines changed: 0 additions & 18 deletions
This file was deleted.

lldb/test/Shell/SymbolFile/NativePDB/namespace-access.cpp

Lines changed: 0 additions & 114 deletions
This file was deleted.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# REQUIRES: target-windows
2+
3+
# Test namespace lookup.
4+
# RUN: split-file %s %t
5+
# RUN: %build --nodefaultlib -o %t.exe -- %t/main.cpp
6+
# RUN: %lldb -f %t.exe -s \
7+
# RUN: %t/commands.input 2>&1 | FileCheck %s
8+
9+
#--- main.cpp
10+
11+
struct S {
12+
char a[1];
13+
};
14+
15+
namespace Outer {
16+
17+
struct S {
18+
char a[2];
19+
};
20+
21+
namespace Inner1 {
22+
struct S {
23+
char a[3];
24+
};
25+
26+
namespace Inner2 {
27+
struct S {
28+
char a[4];
29+
};
30+
} // namespace Inner2
31+
} // namespace Inner1
32+
33+
namespace Inner2 {
34+
struct S {
35+
char a[5];
36+
};
37+
} // namespace Inner2
38+
39+
namespace {
40+
struct A {
41+
char a[6];
42+
};
43+
} // namespace
44+
45+
} // namespace Outer
46+
47+
namespace {
48+
struct A {
49+
char a[7];
50+
};
51+
} // namespace
52+
53+
int main(int argc, char **argv) {
54+
S s;
55+
Outer::S os;
56+
Outer::Inner1::S oi1s;
57+
Outer::Inner1::Inner2::S oi1i2s;
58+
Outer::Inner2::S oi2s;
59+
A a1;
60+
Outer::A a2;
61+
return sizeof(s) + sizeof(os) + sizeof(oi1s) + sizeof(oi1i2s) + sizeof(oi2s) + sizeof(a1) + sizeof(a2);
62+
}
63+
64+
#--- commands.input
65+
66+
b main
67+
r
68+
69+
type lookup S
70+
type lookup ::S
71+
type lookup Outer::S
72+
type lookup Outer::Inner1::S
73+
type lookup Inner1::S
74+
type lookup Outer::Inner1::Inner2::S
75+
type lookup Inner2::S
76+
type lookup Outer::Inner2::S
77+
type lookup Outer::A
78+
type lookup A
79+
type lookup ::A
80+
expr sizeof(S)
81+
expr sizeof(A)
82+
83+
quit
84+
85+
# CHECK: (lldb) type lookup S
86+
# CHECK: struct S {
87+
# CHECK: struct S {
88+
# CHECK: struct S {
89+
# CHECK: struct S {
90+
# CHECK: struct S {
91+
# CHECK: }
92+
# CHECK-NEXT: (lldb) type lookup ::S
93+
# CHECK-NEXT: struct S {
94+
# CHECK-NEXT: char a[1];
95+
# CHECK-NEXT: }
96+
# CHECK-NEXT: (lldb) type lookup Outer::S
97+
# CHECK-NEXT: struct S {
98+
# CHECK-NEXT: char a[2];
99+
# CHECK-NEXT: }
100+
# CHECK-NEXT: (lldb) type lookup Outer::Inner1::S
101+
# CHECK-NEXT: struct S {
102+
# CHECK-NEXT: char a[3];
103+
# CHECK-NEXT: }
104+
# CHECK-NEXT: (lldb) type lookup Inner1::S
105+
# CHECK-NEXT: struct S {
106+
# CHECK-NEXT: char a[3];
107+
# CHECK-NEXT: }
108+
# CHECK-NEXT: (lldb) type lookup Outer::Inner1::Inner2::S
109+
# CHECK-NEXT: struct S {
110+
# CHECK-NEXT: char a[4];
111+
# CHECK-NEXT: }
112+
# CHECK-NEXT: (lldb) type lookup Inner2::S
113+
# CHECK-NEXT: struct S {
114+
# CHECK: struct S {
115+
# CHECK: }
116+
# CHECK-NEXT: (lldb) type lookup Outer::Inner2::S
117+
# CHECK-NEXT: struct S {
118+
# CHECK-NEXT: char a[5];
119+
# CHECK-NEXT: }
120+
# CHECK-NEXT: (lldb) type lookup Outer::A
121+
# CHECK-NEXT: struct A {
122+
# CHECK-NEXT: char a[6];
123+
# CHECK-NEXT: }
124+
# CHECK-NEXT: (lldb) type lookup A
125+
# CHECK-NEXT: struct A {
126+
# CHECK: struct A {
127+
# CHECK: }
128+
# CHECK-NEXT: (lldb) type lookup ::A
129+
# CHECK-NEXT: struct A {
130+
# CHECK-NEXT: char a[7];
131+
# CHECK-NEXT: }
132+
# CHECK-NEXT: (lldb) expr sizeof(S)
133+
# CHECK-NEXT: (__size_t) $0 = 1
134+
# CHECK-NEXT: (lldb) expr sizeof(A)
135+
# CHECK-NEXT: (__size_t) $1 = 7

0 commit comments

Comments
 (0)