|
1 |
| -// RUN: %target-swift-frontend -I %S/Inputs -enable-cxx-interop -emit-sil %s | %FileCheck %s |
| 1 | +// RUN: %target-swift-frontend -I %S/Inputs -enable-cxx-interop -emit-silgen %s | %FileCheck %s |
2 | 2 |
|
3 | 3 | import Constructors
|
4 | 4 |
|
5 | 5 | // The most important thing to test here is that the constructor result is
|
6 | 6 | // returned with an @out attribute.
|
| 7 | +// CHECK-LABEL: sil [ossa] @$s4main24testConstructorWithParamyyF : $@convention(thin) () -> () |
7 | 8 | // CHECK: [[VAR:%[0-9]+]] = alloc_stack $ConstructorWithParam
|
8 |
| -// CHECK: [[LITERAL:%[0-9]+]] = integer_literal $Builtin.Int32, 42 |
9 |
| -// CHECK: [[INT:%[0-9]+]] = struct $Int32 ([[LITERAL]] : $Builtin.Int32) |
| 9 | +// CHECK: [[LITERAL:%[0-9]+]] = integer_literal $Builtin.IntLiteral, 42 |
| 10 | +// CHECK: [[INT:%[0-9]+]] = apply %{{[0-9]+}}([[LITERAL]], %{{[0-9]+}}) |
10 | 11 | // CHECK: [[FUNC:%[0-9]+]] = function_ref @{{_ZN20ConstructorWithParamC1Ei|\?\?0ConstructorWithParam@@QEAA@H@Z}} : $@convention(c) (Int32) -> @out ConstructorWithParam
|
11 | 12 | // CHECK: %{{[0-9]+}} = apply [[FUNC]]([[VAR]], [[INT]]) : $@convention(c) (Int32) -> @out ConstructorWithParam
|
12 |
| -let _ = ConstructorWithParam(42) |
| 13 | +// CHECK-LABEL: end sil function '$s4main24testConstructorWithParamyyF' |
| 14 | + |
| 15 | +// CHECK-LABEL: sil [clang ConstructorWithParam.init] @{{_ZN20ConstructorWithParamC1Ei|\?\?0ConstructorWithParam@@QEAA@H@Z}} : $@convention(c) (Int32) -> @out ConstructorWithParam |
| 16 | +public func testConstructorWithParam() { |
| 17 | + let c = ConstructorWithParam(42) |
| 18 | +} |
| 19 | + |
| 20 | +// CHECK-LABEL: sil [ossa] @$s4main18emptyTypeNoArgInityyF : $@convention(thin) () -> () |
| 21 | +// CHECK: [[AS:%.*]] = alloc_stack $EmptyStruct |
| 22 | +// CHECK: [[FN:%.*]] = function_ref @{{_ZN11EmptyStructC1Ev|\?\?0EmptyStruct@@QEAA@XZ}} : $@convention(c) () -> @out EmptyStruct |
| 23 | +// CHECK: apply [[FN]]([[AS]]) : $@convention(c) () -> @out EmptyStruct |
| 24 | +// CHECK-LABEL: end sil function '$s4main18emptyTypeNoArgInityyF' |
| 25 | + |
| 26 | +// CHECL-LABEL: sil [clang EmptyStruct.init] @{{_ZN11EmptyStructC1Ev|\?\?0EmptyStruct@@QEAA@XZ}} : $@convention(c) () -> @out EmptyStruct |
| 27 | +public func emptyTypeNoArgInit() { |
| 28 | + let e = EmptyStruct() |
| 29 | +} |
| 30 | + |
| 31 | +// CHECK-LABEL: sil [ossa] @$s4main25singleMemberTypeNoArgInityyF : $@convention(thin) () -> () |
| 32 | +// CHECK: [[AS:%.*]] = alloc_stack $IntWrapper |
| 33 | +// CHECK: [[FN:%.*]] = function_ref @{{_ZN10IntWrapperC1Ev|\?\?0IntWrapper@@QEAA@XZ}} : $@convention(c) () -> @out IntWrapper |
| 34 | +// CHECK: apply [[FN]]([[AS]]) : $@convention(c) () -> @out IntWrapper |
| 35 | +// CHECK-LABEL: end sil function '$s4main25singleMemberTypeNoArgInityyF' |
| 36 | + |
| 37 | +//CHECK-LABEL: sil [clang IntWrapper.init] @{{_ZN10IntWrapperC1Ev|\?\?0IntWrapper@@QEAA@XZ}} : $@convention(c) () -> @out IntWrapper |
| 38 | +public func singleMemberTypeNoArgInit() { |
| 39 | + let i = IntWrapper() |
| 40 | +} |
| 41 | + |
| 42 | +// CHECK-LABEL: sil shared [transparent] [serializable] [ossa] @$sSo10IntWrapperV1xABs5Int32V_tcfC : $@convention(method) (Int32, @thin IntWrapper.Type) -> IntWrapper |
| 43 | +// CHECK: bb0([[I:%[0-9]+]] : $Int32, %{{[0-9]+}} : $@thin IntWrapper.Type): |
| 44 | +// CHECK-NEXT: [[S:%.*]] = struct $IntWrapper ([[I]] : $Int32) |
| 45 | +// CHECK-NEXT: return [[S]] |
| 46 | +// CHECK-LABEL: end sil function '$sSo10IntWrapperV1xABs5Int32V_tcfC' |
| 47 | +public func singleMemberTypeValueInit() { |
| 48 | + let i = IntWrapper(x: 42) |
| 49 | +} |
| 50 | + |
| 51 | +// CHECK-LABEL: sil shared [transparent] [serializable] [ossa] @$sSo25DefaultConstructorDeletedV1aABSpys5Int32VG_tcfC : $@convention(method) (UnsafeMutablePointer<Int32>, @thin DefaultConstructorDeleted.Type) -> DefaultConstructorDeleted |
| 52 | +// CHECK: bb0([[A:%.*]] : $UnsafeMutablePointer<Int32> |
| 53 | +// CHECK-NEXT: [[OUT:%.*]] = struct $DefaultConstructorDeleted ([[A]] : $UnsafeMutablePointer<Int32>) |
| 54 | +// CHECK-NEXT: return [[OUT]] : $DefaultConstructorDeleted |
| 55 | +// CHECK-LABEL: end sil function '$sSo25DefaultConstructorDeletedV1aABSpys5Int32VG_tcfC' |
| 56 | +public func deletedConstructor(a: UnsafeMutablePointer<Int32>) { |
| 57 | + let deletedExplicitly = DefaultConstructorDeleted(a: a) |
| 58 | +} |
0 commit comments