|
| 1 | +// REQUIRES: objc_interop |
| 2 | + |
| 3 | +import ConstRefParameter |
| 4 | + |
| 5 | +func testFunction() { |
| 6 | + let a = OptionsStruct(intOption: 1, floatOption: 2.0) |
| 7 | + |
| 8 | + let objc = OptionsConsumerObjC(options: a) |
| 9 | + _ = objc.doOtherThing(withOptions: a) |
| 10 | + _ = OptionsConsumerObjC.consumer(withOptions: a) |
| 11 | + _ = OptionsConsumerObjC.doThing(withOptions: a) |
| 12 | + |
| 13 | + var cxx = OptionsConsumerCxx(a) |
| 14 | + _ = cxx.doOtherThing(a) |
| 15 | + _ = OptionsConsumerCxx.build(a) |
| 16 | + _ = OptionsConsumerCxx.doThing(a) |
| 17 | +} |
| 18 | + |
| 19 | +// RUN: %target-swift-ide-test -print-module -module-to-print=ConstRefParameter -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop | %FileCheck -check-prefix=CHECK-IDE-TEST %s |
| 20 | + |
| 21 | +// CHECK-IDE-TEST: class OptionsConsumerObjC |
| 22 | +// CHECK-IDE-TEST: init(options: OptionsStruct) |
| 23 | +// COM: FIXME: should it be consumer(options:)? |
| 24 | +// CHECK-IDE-TEST: class func consumer(withOptions options: OptionsStruct) -> Self |
| 25 | +// COM: FIXME: should it be doThing(options:)? |
| 26 | +// CHECK-IDE-TEST: class func doThing(withOptions options: OptionsStruct) -> Int32 |
| 27 | +// COM: FIXME: should it be doOtherThing(options:)? |
| 28 | +// CHECK-IDE-TEST: func doOtherThing(withOptions options: OptionsStruct) -> Float |
| 29 | + |
| 30 | +// CHECK-IDE-TEST: struct OptionsConsumerCxx |
| 31 | +// CHECK-IDE-TEST: init(_ options: OptionsStruct) |
| 32 | +// CHECK-IDE-TEST: static func build(_ options: OptionsStruct) -> OptionsConsumerCxx |
| 33 | +// CHECK-IDE-TEST: static func doThing(_ options: OptionsStruct) -> Int32 |
| 34 | +// CHECK-IDE-TEST: mutating func doOtherThing(_ options: OptionsStruct) -> Float |
| 35 | + |
| 36 | + |
| 37 | +// RUN: %target-swift-frontend -c -enable-experimental-cxx-interop -enable-objc-interop -I %S/Inputs %s -emit-sil -o - | %FileCheck %s |
| 38 | + |
| 39 | +// COM: FIXME: should it be @in_guaranteed OptionsStruct? |
| 40 | +// CHECK: [[FN1:%[0-9]+]] = function_ref @$sSo19OptionsConsumerObjCC7optionsABSo0A6StructV_tcfC : $@convention(method) (OptionsStruct, @thick OptionsConsumerObjC.Type) -> @owned OptionsConsumerObjC |
| 41 | +// CHECK-NEXT: apply [[FN1]] |
| 42 | +// CHECK-SAME: : $@convention(method) (OptionsStruct, @thick OptionsConsumerObjC.Type) -> @owned OptionsConsumerObjC |
| 43 | + |
| 44 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 45 | +// CHECK: [[FN2:%[0-9]+]] = objc_method %8 : $OptionsConsumerObjC, #OptionsConsumerObjC.doOtherThing!foreign : (OptionsConsumerObjC) -> (OptionsStruct) -> Float, $@convention(objc_method) (@in OptionsStruct, OptionsConsumerObjC) -> Float |
| 46 | +// CHECK-NEXT: apply [[FN2]] |
| 47 | +// CHECK-SAME: : $@convention(objc_method) (@in OptionsStruct, OptionsConsumerObjC) -> Float |
| 48 | + |
| 49 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 50 | +// CHECK: [[FN3:%[0-9]+]] = objc_method %15 : $@objc_metatype OptionsConsumerObjC.Type, #OptionsConsumerObjC.consumer!foreign : (OptionsConsumerObjC.Type) -> (OptionsStruct) -> @dynamic_self OptionsConsumerObjC, $@convention(objc_method) (@in OptionsStruct, @objc_metatype OptionsConsumerObjC.Type) -> @autoreleased OptionsConsumerObjC |
| 51 | +// CHECK-NEXT: apply [[FN3]] |
| 52 | +// CHECK-SAME: : $@convention(objc_method) (@in OptionsStruct, @objc_metatype OptionsConsumerObjC.Type) -> @autoreleased OptionsConsumerObjC |
| 53 | + |
| 54 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 55 | +// CHECK: [[FN4:%[0-9]+]] = objc_method %22 : $@objc_metatype OptionsConsumerObjC.Type, #OptionsConsumerObjC.doThing!foreign : (OptionsConsumerObjC.Type) -> (OptionsStruct) -> Int32, $@convention(objc_method) (@in OptionsStruct, @objc_metatype OptionsConsumerObjC.Type) -> Int32 |
| 56 | +// CHECK-NEXT: apply [[FN4]] |
| 57 | +// CHECK-SAME: : $@convention(objc_method) (@in OptionsStruct, @objc_metatype OptionsConsumerObjC.Type) -> Int32 |
| 58 | + |
| 59 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 60 | +// CHECK: [[FN5:%[0-9]+]] = function_ref @_ZN18OptionsConsumerCxxC1ERK13OptionsStruct : $@convention(c) (OptionsStruct) -> @out OptionsConsumerCxx |
| 61 | +// CHECK-NEXT: apply [[FN5]] |
| 62 | +// CHECK-SAME: : $@convention(c) (OptionsStruct) -> @out OptionsConsumerCxx |
| 63 | + |
| 64 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 65 | +// CHECK: [[FN6:%[0-9]+]] = function_ref @_ZN18OptionsConsumerCxx12doOtherThingERK13OptionsStruct : $@convention(cxx_method) (@in OptionsStruct, @inout OptionsConsumerCxx) -> Float |
| 66 | +// CHECK-NEXT: apply [[FN6]] |
| 67 | +// CHECK-SAME: : $@convention(cxx_method) (@in OptionsStruct, @inout OptionsConsumerCxx) -> Float |
| 68 | + |
| 69 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 70 | +// CHECK: [[FN6:%[0-9]+]] = function_ref @_ZN18OptionsConsumerCxx5buildERK13OptionsStruct : $@convention(c) (@in OptionsStruct) -> OptionsConsumerCxx |
| 71 | +// CHECK-NEXT: apply [[FN6]] |
| 72 | +// CHECK-SAME: : $@convention(c) (@in OptionsStruct) -> OptionsConsumerCxx |
| 73 | + |
| 74 | +// COM: FIXME: should it be @in_guaranteed OptionStruct? |
| 75 | +// CHECK: [[FN7:%[0-9]+]] = function_ref @_ZN18OptionsConsumerCxx7doThingERK13OptionsStruct : $@convention(c) (@in OptionsStruct) -> Int32 |
| 76 | +// CHECK-NEXT: apply [[FN7]] |
| 77 | +// CHECK-SAME: : $@convention(c) (@in OptionsStruct) -> Int32 |
0 commit comments