]>
Commit | Line | Data |
---|---|---|
5e7ed085 | 1 | // compile-flags: -O -C no-prepopulate-passes |
cdc7bbd5 | 2 | // |
2c00a5a8 XL |
3 | |
4 | // ignore-arm | |
3dfed10e | 5 | // ignore-aarch64 |
2c00a5a8 XL |
6 | // ignore-mips |
7 | // ignore-mips64 | |
8 | // ignore-powerpc | |
9 | // ignore-powerpc64 | |
f035d41b | 10 | // ignore-riscv64 see codegen/riscv-abi |
9c376795 | 11 | // ignore-s390x |
416331ca | 12 | // ignore-windows |
2c00a5a8 XL |
13 | // See repr-transparent.rs |
14 | ||
dfeec247 | 15 | #![feature(transparent_unions)] |
dc9dc135 | 16 | |
2c00a5a8 | 17 | #![crate_type="lib"] |
2c00a5a8 XL |
18 | |
19 | ||
dc9dc135 | 20 | #[derive(Clone, Copy)] |
2c00a5a8 | 21 | #[repr(C)] |
dc9dc135 XL |
22 | pub struct BigS([u32; 16]); |
23 | ||
24 | #[repr(transparent)] | |
25 | pub struct TsBigS(BigS); | |
26 | ||
27 | #[repr(transparent)] | |
28 | pub union TuBigS { | |
29 | field: BigS, | |
30 | } | |
2c00a5a8 XL |
31 | |
32 | #[repr(transparent)] | |
dc9dc135 XL |
33 | pub enum TeBigS { |
34 | Variant(BigS), | |
35 | } | |
36 | ||
923072b8 | 37 | // CHECK: define{{.*}}void @test_BigS({{%BigS\*|ptr}} [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], {{%BigS\*|ptr}} [[BIGS_ARG_ATTRS1:.*]] byval(%BigS) [[BIGS_ARG_ATTRS2:.*]]) |
dc9dc135 | 38 | #[no_mangle] |
5869c6ff | 39 | pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } |
dc9dc135 | 40 | |
923072b8 | 41 | // CHECK: define{{.*}}void @test_TsBigS({{%TsBigS\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], {{%TsBigS\*|ptr}} [[BIGS_ARG_ATTRS1]] byval(%TsBigS) [[BIGS_ARG_ATTRS2:.*]]) |
dc9dc135 | 42 | #[no_mangle] |
5869c6ff | 43 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } |
2c00a5a8 | 44 | |
923072b8 | 45 | // CHECK: define{{.*}}void @test_TuBigS({{%TuBigS\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], {{%TuBigS\*|ptr}} [[BIGS_ARG_ATTRS1]] byval(%TuBigS) [[BIGS_ARG_ATTRS2:.*]]) |
2c00a5a8 | 46 | #[no_mangle] |
5869c6ff | 47 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } |
2c00a5a8 | 48 | |
923072b8 | 49 | // CHECK: define{{.*}}void @test_TeBigS({{%"TeBigS::Variant"\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], {{%"TeBigS::Variant"\*|ptr}} [[BIGS_ARG_ATTRS1]] byval(%"TeBigS::Variant") [[BIGS_ARG_ATTRS2]]) |
2c00a5a8 | 50 | #[no_mangle] |
5869c6ff | 51 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } |
2c00a5a8 XL |
52 | |
53 | ||
dc9dc135 | 54 | #[derive(Clone, Copy)] |
2c00a5a8 XL |
55 | #[repr(C)] |
56 | pub union BigU { | |
57 | foo: [u32; 16], | |
58 | } | |
59 | ||
60 | #[repr(transparent)] | |
dc9dc135 XL |
61 | pub struct TsBigU(BigU); |
62 | ||
63 | #[repr(transparent)] | |
64 | pub union TuBigU { | |
65 | field: BigU, | |
66 | } | |
67 | ||
68 | #[repr(transparent)] | |
69 | pub enum TeBigU { | |
70 | Variant(BigU), | |
71 | } | |
2c00a5a8 | 72 | |
923072b8 | 73 | // CHECK: define{{.*}}void @test_BigU({{%BigU\*|ptr}} [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], {{%BigU\*|ptr}} [[BIGU_ARG_ATTRS1:.*]] byval(%BigU) [[BIGU_ARG_ATTRS2:.*]]) |
2c00a5a8 | 74 | #[no_mangle] |
5869c6ff | 75 | pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } |
2c00a5a8 | 76 | |
923072b8 | 77 | // CHECK: define{{.*}}void @test_TsBigU({{%TsBigU\*|ptr}} [[BIGU_RET_ATTRS1:.*]] sret(%TsBigU) [[BIGU_RET_ATTRS2:.*]], {{%TsBigU\*|ptr}} [[BIGU_ARG_ATTRS1]] byval(%TsBigU) [[BIGU_ARG_ATTRS2]]) |
dc9dc135 | 78 | #[no_mangle] |
5869c6ff | 79 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } |
dc9dc135 | 80 | |
923072b8 | 81 | // CHECK: define{{.*}}void @test_TuBigU({{%TuBigU\*|ptr}} [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2:.*]], {{%TuBigU\*|ptr}} [[BIGU_ARG_ATTRS1]] byval(%TuBigU) [[BIGU_ARG_ATTRS2]]) |
dc9dc135 | 82 | #[no_mangle] |
5869c6ff | 83 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } |
dc9dc135 | 84 | |
923072b8 | 85 | // CHECK: define{{.*}}void @test_TeBigU({{%"TeBigU::Variant"\*|ptr}} [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2:.*]], {{%"TeBigU::Variant"\*|ptr}} [[BIGU_ARG_ATTRS1]] byval(%"TeBigU::Variant") [[BIGU_ARG_ATTRS2]]) |
2c00a5a8 | 86 | #[no_mangle] |
5869c6ff | 87 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } |