]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/unwind-abis/thiscall-unwind-abi.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / codegen / unwind-abis / thiscall-unwind-abi.rs
CommitLineData
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, abi_thiscall)]
5#[lang="sized"]
6trait Sized { }
6a06907d
XL
7
8// Test that `nounwind` atributes are correctly applied to exported `thiscall` and
9// `thiscall-unwind` extern functions. `thiscall-unwind` functions MUST NOT have this attribute. We
10// disable 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]
14pub extern "thiscall" fn rust_item_that_cannot_unwind() {
15}
16
17// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
18#[no_mangle]
19pub extern "thiscall-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: }