Author: Pavel Labath Date: 2024-06-06T16:10:22Z New Revision: de3f1b6d68ab8a0e827db84b328803857a4f60df
URL: https://github.com/llvm/llvm-project/commit/de3f1b6d68ab8a0e827db84b328803857a4f60df DIFF: https://github.com/llvm/llvm-project/commit/de3f1b6d68ab8a0e827db84b328803857a4f60df.diff LOG: [lldb] Test case for the bug in #92328 Added: lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp Modified: Removed: ################################################################################ diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp new file mode 100644 index 0000000000000..a8a4d3b8fbd5f --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp @@ -0,0 +1,44 @@ +// Test that we can correctly resolve forward declared types when they only +// diff er in the template arguments of the surrounding context. The reproducer +// is sensitive to the order of declarations, so we test in both directions. + +// REQUIRES: lld + +// RUN: %clang --target=x86_64-pc-linux -c %s -o %t-a.o -g -gsimple-template-names -DFILE_A +// RUN: %clang --target=x86_64-pc-linux -c %s -o %t-b.o -g -gsimple-template-names -DFILE_B +// RUN: ld.lld %t-a.o %t-b.o -o %t +// RUN: %lldb %t -o "target variable --ptr-depth 1 --show-types both_a both_b" -o exit | FileCheck %s + +// CHECK: (lldb) target variable +// CHECK-NEXT: (ReferencesBoth<'A'>) both_a = { +// CHECK-NEXT: (Outer<'A'>::Inner *) a = 0x{{[0-9A-Fa-f]*}} {} +// CHECK-NEXT: (Outer<'A'>::Inner *) b = 0x{{[0-9A-Fa-f]*}} {} +// CHECK-NEXT: } +// CHECK-NEXT: (ReferencesBoth<'B'>) both_b = { +// CHECK-NEXT: (Outer<'A'>::Inner *) a = 0x{{[0-9A-Fa-f]*}} {} +// CHECK-NEXT: (Outer<'B'>::Inner *) b = 0x{{[0-9A-Fa-f]*}} {} +// CHECK-NEXT: } + +template<char C> +struct Outer { + struct Inner {}; +}; + +template<char C> +struct ReferencesBoth { + Outer<'A'>::Inner *a; + Outer<'B'>::Inner *b; +}; + +#ifdef FILE_A +Outer<'A'>::Inner inner_a; +extern Outer<'B'>::Inner inner_b; + +ReferencesBoth<'A'> both_a{&inner_a, &inner_b}; + +#else +extern Outer<'A'>::Inner inner_a; +Outer<'B'>::Inner inner_b; + +ReferencesBoth<'B'> both_b{&inner_a, &inner_b}; +#endif _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits