]>
Commit | Line | Data |
---|---|---|
136023e0 XL |
1 | // needs-llvm-components: x86 |
2 | // compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes | |
3 | #![no_core] | |
4 | #![feature(no_core, lang_items, c_unwind)] | |
5 | #[lang="sized"] | |
6 | trait Sized { } | |
6a06907d | 7 | |
f2b60f7d | 8 | // Test that `nounwind` attributes are correctly applied to exported `stdcall` and `stdcall-unwind` |
6a06907d XL |
9 | // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable |
10 | // optimizations above to prevent LLVM from inferring the attribute. | |
11 | ||
6a06907d XL |
12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
13 | #[no_mangle] | |
14 | pub extern "stdcall" fn rust_item_that_cannot_unwind() { | |
15 | } | |
16 | ||
17 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { | |
18 | #[no_mangle] | |
19 | pub extern "stdcall-unwind" fn rust_item_that_can_unwind() { | |
20 | } | |
21 | ||
22 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make | |
23 | // sure that the first item is correctly marked with the `nounwind` attribute: | |
24 | // | |
25 | // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } | |
26 | // | |
27 | // Next, let's assert that the second item, which CAN unwind, does not have this attribute. | |
28 | // | |
29 | // CHECK: attributes #1 = { | |
30 | // CHECK-NOT: nounwind | |
31 | // CHECK: } |