1 // compile-flags: -C opt-level=0
3 // Test that `nounwind` attributes are correctly applied to exported `C` and `C-unwind` extern
4 // functions. `C-unwind` functions MUST NOT have this attribute. We disable optimizations above
5 // to prevent LLVM from inferring the attribute.
10 // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
12 pub extern "C" fn rust_item_that_cannot_unwind() {
15 // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
17 pub extern "C-unwind" fn rust_item_that_can_unwind() {
20 // Now, make some assertions that the LLVM attributes for these functions are correct. First, make
21 // sure that the first item is correctly marked with the `nounwind` attribute:
23 // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} }
25 // Next, let's assert that the second item, which CAN unwind, does not have this attribute.
27 // CHECK: attributes #1 = {
28 // CHECK-NOT: nounwind