1 | // Test that we can correctly disambiguate a nested type (where the outer type |
2 | // is in a type unit) from a non-nested type with the same basename. Failure to |
3 | // do so can cause us to think a type is a member of itself, which caused |
4 | // infinite recursion (crash) in the past. |
5 | |
6 | // REQUIRES: lld |
7 | |
8 | // RUN: %clang --target=x86_64-pc-linux -c %s -o %t-a.o -g -fdebug-types-section -flimit-debug-info -DFILE_A |
9 | // RUN: %clang --target=x86_64-pc-linux -c %s -o %t-b.o -g -fdebug-types-section -flimit-debug-info -DFILE_B |
10 | // RUN: ld.lld -z undefs %t-a.o %t-b.o -o %t |
11 | // RUN: %lldb %t -o "target variable x" -o exit | FileCheck %s |
12 | |
13 | // CHECK: (lldb) target variable |
14 | // CHECK-NEXT: (const X) x = { |
15 | // CHECK-NEXT: NS::Outer::Struct = { |
16 | // CHECK-NEXT: x = 42 |
17 | // CHECK-NEXT: o = (x = 47) |
18 | // CHECK-NEXT: y = 24 |
19 | // CHECK-NEXT: } |
20 | // CHECK-NEXT: } |
21 | |
22 | namespace NS { |
23 | struct Struct { |
24 | int x = 47; |
25 | virtual void anchor(); |
26 | }; |
27 | } // namespace NS |
28 | |
29 | #ifdef FILE_A |
30 | namespace NS { |
31 | struct Outer { |
32 | struct Struct { |
33 | int x = 42; |
34 | NS::Struct o; |
35 | int y = 24; |
36 | }; |
37 | }; |
38 | } // namespace NS |
39 | |
40 | struct X : NS::Outer::Struct {}; |
41 | extern constexpr X x = {}; |
42 | #endif |
43 | #ifdef FILE_B |
44 | void NS::Struct::anchor() {} |
45 | #endif |
46 | |