forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathctypes_ir.swift
36 lines (27 loc) · 1.09 KB
/
ctypes_ir.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o - -primary-file %s | FileCheck %s
// REQUIRES: OS=macosx
import ctypes
// CHECK-LABEL: define hidden void @_TF9ctypes_ir9testColorFT_T_
func testColor() {
// CHECK: store i32 1
var c : Color = green
}
// CHECK-LABEL: define hidden void @_TF9ctypes_ir12testAnonEnumFT_T_
func testAnonEnum() {
// CHECK: store i64 30064771073
var a = AnonConst2
}
// CHECK-LABEL: define hidden void @_TF9ctypes_ir17testAnonEnumSmallFT_T_
func testAnonEnumSmall() {
// CHECK: store i64 17
var a = AnonConstSmall2
}
func testStructWithFlexibleArray(s : StructWithFlexibleArray) {
var a = s.a
}
// Make sure flexible array struct member isn't represented in IR function signature as i0 (or at all). rdar://problem/18510461
// CHECK-LABEL: define hidden void @_TF9ctypes_ir27testStructWithFlexibleArrayFVSC23StructWithFlexibleArrayT_(i32)
typealias EightUp = (Int8, Int8, Int8, Int8, Int8, Int8, Int8, Int8)
func testArrays(x: UnsafeMutablePointer<Int8>, y: UnsafeMutablePointer<Int8>, z: UnsafeMutablePointer<EightUp>) {
useArray(x, y, z)
}