1 // compile-flags: -C opt-level=0
3 // Test that `nounwind` attributes are correctly applied to exported `system` and `system-unwind`
4 // extern functions. `system-unwind` functions MUST NOT have this attribute. We disable
5 // optimizations above to prevent LLVM from inferring the attribute.
10 // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
12 pub extern "system" fn rust_item_that_cannot_unwind() {
15 // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
17 pub extern "system-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