For a definition (of most linkage types), dso_local is set for ELF -fno-pic/-fpie
and COFF, but not for Mach-O. This nuance causes unneeded binary format differences.
This patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `
if there is an explicit linkage.
* Clang will set dso_local for Mach-O, which is currently implied by TargetMachine.cpp. This will make COFF/Mach-O and executable ELF similar.
* Eventually I hope we can make dso_local the textual LLVM IR default (write explicit "dso_preemptable" when applicable) and -fpic ELF will be similar to everything else. This patch helps move toward that goal.
26 lines
953 B
C++
26 lines
953 B
C++
// RUN: %clang_cc1 -debug-info-kind=standalone -std=c++11 -triple x86_64-darwin -emit-llvm -o - %s | FileCheck %s
|
|
|
|
struct A {
|
|
A(int, ...);
|
|
};
|
|
struct B : A {
|
|
using A::A;
|
|
};
|
|
|
|
A::A(int i, ...) {}
|
|
// CHECK: define{{.*}} void @{{.*}}foo
|
|
// CHECK-NOT: ret void
|
|
// CHECK: call void @llvm.dbg.declare
|
|
// CHECK-NOT: ret void
|
|
// CHECK: call void @llvm.dbg.declare(metadata %{{.*}}** %{{[^,]+}},
|
|
// CHECK-SAME: metadata ![[THIS:[0-9]+]], metadata !DIExpression()), !dbg ![[LOC:[0-9]+]]
|
|
// CHECK: ret void, !dbg ![[NOINL:[0-9]+]]
|
|
// CHECK: ![[FOO:.*]] = distinct !DISubprogram(name: "foo"
|
|
// CHECK-DAG: ![[A:.*]] = distinct !DISubprogram(name: "A", linkageName: "_ZN1BCI11AEiz"
|
|
void foo() {
|
|
// CHECK-DAG: ![[LOC]] = !DILocation(line: 0, scope: ![[A]], inlinedAt: ![[INL:[0-9]+]])
|
|
// CHECK-DAG: ![[INL]] = !DILocation(line: [[@LINE+1]], column: 5, scope: ![[FOO]])
|
|
B b(0);
|
|
// CHECK: ![[NOINL]] = !DILocation(line: [[@LINE+1]], column: 1, scope: !{{[0-9]+}})
|
|
}
|