llvm-project/clang/test/CodeGenCXX/new-array-init-exceptions.cpp
Fangrui Song fd739804e0 [test] Add {{.*}} to make ELF tests immune to dso_local/dso_preemptable/(none) differences
For a default visibility external linkage definition, dso_local is set for ELF
-fno-pic/-fpie and COFF and Mach-O. Since default clang -cc1 for ELF is similar
to -fpic ("PIC Level" is not set), this nuance causes unneeded binary format differences.

To make emitted IR similar, ELF -cc1 -fpic will default to -fno-semantic-interposition,
which sets dso_local for default visibility external linkage definitions.

To make this flip smooth and enable future (dso_local as definition default),
this patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `.
2020-12-31 00:27:11 -08:00

42 lines
1.3 KiB
C++

// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown -fexceptions -fcxx-exceptions %s -emit-llvm -o - | FileCheck %s
// REQUIRES: asserts
struct Throws {
Throws(int);
Throws();
~Throws();
};
// CHECK-LABEL: define{{.*}} void @_Z7cleanupi
void cleanup(int n) {
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD:[^ ]+]]
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
// CHECK: invoke void @_ZN6ThrowsC1Ev
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
new Throws[n] { 1, 2, 3 };
// CHECK: [[LPAD]]:
// CHECK-NEXT: landingpad
// CHECK: call void @_ZN6ThrowsD1Ev
// CHECK: call void @_ZdaPv
}
// CHECK-LABEL: define{{.*}} void @_Z7cleanupv
void cleanup() {
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2:[^ ]+]]
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]]
// CHECK: invoke void @_ZN6ThrowsC1Ei
// CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]]
new Throws[3] { 1, 2, 3 };
// CHECK: [[LPAD2]]:
// CHECK-NEXT: landingpad
// CHECK: call void @_ZN6ThrowsD1Ev
// CHECK: call void @_ZdaPv
}