xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp (revision 2e425bf629f80c8f8582c266d25a384e7549198d)
1 // Test lldb is able to compute the fully qualified names on templates with
2 // -gsimple-template-names and -fdebug-types-section.
3 
4 // REQUIRES: lld
5 
6 // Test against logging to see if we print the fully qualified names correctly.
7 // RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names %s -c -o %t1.o
8 // RUN: ld.lld %t1.o -o %t1
9 // RUN: %lldb %t1 -o "log enable dwarf comp" -o "target variable v3" -o exit | FileCheck %s --check-prefix=LOG
10 
11 // Test that we following DW_AT_signature correctly. If not, lldb might confuse the types of v1 and v2.
12 // RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names -fdebug-types-section %s -c -o %t2.o
13 // RUN: ld.lld %t2.o -o %t2
14 // RUN: %lldb %t2 -o "target variable v1 v2" -o exit | FileCheck %s --check-prefix=TYPE
15 
16 // LOG: unique name: t3<t2<int> >::t4
17 
18 // TYPE:      (t2<outer_struct1::t1<int> >) v1 = {}
19 // TYPE-NEXT: (t2<outer_struct2::t1<int> >) v2 = {}
20 
21 struct outer_struct1 {
22   template <typename> struct t1 {};
23 };
24 
25 struct outer_struct2 {
26   template <typename> struct t1 {};
27 };
28 
29 template <typename> struct t2 {};
30 t2<outer_struct1::t1<int>> v1;
31 t2<outer_struct2::t1<int>> v2;
32 
33 template <typename> struct t3 {
34   struct t4 {};
35 };
36 t3<t2<int>>::t4 v3;
37