Skip to content

Commit 4a023b4

Browse files
[c-interop][test] Re-write call abi checks with C struct in more flexible way
To fix windows-x86_64 case, which doesn't have byval.
1 parent 76cd46f commit 4a023b4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test/IRGen/extern_c_abitypes.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
3-
// RUN: %target-swift-frontend -emit-ir %t/extern_c.swift -I%t | %FileCheck %s --check-prefixes CHECK,%target-cpu
3+
// RUN: %target-swift-frontend -emit-ir %t/extern_c.swift -I%t | %FileCheck %s
44

55
//--- c_abi_types.h
66
#include <stdbool.h>
@@ -99,12 +99,8 @@ func test() {
9999

100100
// assume %struct.c_struct and %TSo8c_structV have compatible layout
101101
//
102-
// x86_64: call void @c_roundtrip_c_struct(ptr noalias nocapture sret(%struct.c_struct) {{.*}}, ptr byval(%struct.c_struct) align 8 {{.*}})
103-
// x86_64: call void @swift_roundtrip_c_struct(ptr noalias nocapture sret(%TSo8c_structV) {{.*}}, ptr byval(%TSo8c_structV) align 8 {{.*}})
104-
// arm64: call void @c_roundtrip_c_struct(ptr noalias nocapture sret(%struct.c_struct) {{.*}}, ptr {{.*}})
105-
// arm64: call void @swift_roundtrip_c_struct(ptr noalias nocapture sret(%TSo8c_structV) {{.*}}, ptr {{.*}})
106-
// wasm32: call void @c_roundtrip_c_struct(ptr noalias nocapture sret(%struct.c_struct) {{.*}}, ptr byval(%struct.c_struct) align 4 {{.*}})
107-
// wasm32: call void @swift_roundtrip_c_struct(ptr noalias nocapture sret(%TSo8c_structV) {{.*}}, ptr byval(%TSo8c_structV) align 4 {{.*}})
102+
// CHECK: call void @c_roundtrip_c_struct(ptr noalias nocapture sret(%struct.c_struct) {{.*}}, ptr{{( byval\(%struct.c_struct\))?}}[[ALIGN:(align [0-9]+)?]] {{.*}})
103+
// CHECK: call void @swift_roundtrip_c_struct(ptr noalias nocapture sret(%TSo8c_structV) {{.*}}, ptr{{( byval\(%TSo8c_structV\))?}}[[ALIGN]] {{.*}})
108104
var c_struct_val = c_struct(foo: 496, bar: 28, baz: 8)
109105
_ = c_roundtrip_c_struct(c_struct_val)
110106
_ = swift_roundtrip_c_struct(c_struct_val)

0 commit comments

Comments
 (0)