1 // REQUIRES: lld
2
3 // RUN: %clang %s -gdwarf-5 -gpubnames -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \
4 // RUN: llc -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o
5 // RUN: llvm-objcopy --split-dwo=%t-1.dwo %t-1.o
6 // RUN: %clang %s -gdwarf-5 -gpubnames -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \
7 // RUN: llc -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o
8 // RUN: llvm-objcopy --split-dwo=%t-2.dwo %t-2.o
9 // RUN: ld.lld %t-1.o %t-2.o -o %t
10 // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
11 // RUN: lldb-test symbols --name=foo --find=variable %t | FileCheck %s
12
13 // NAMES: Name: .debug_names
14
15 // CHECK: Found 2 variables:
16 #ifdef ONE
17 namespace one {
18 int foo;
19 // CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-variable-dwo.cpp:[[@LINE-1]]
20 } // namespace one
21
_start()22 extern "C" void _start() {}
23 #else
24 namespace two {
25 int foo;
26 // CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-variable-dwo.cpp:[[@LINE-1]]
27 } // namespace two
28 #endif
29