mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
To make this stick, I've disallowed direct use of that overload of CreateCall. I've left the Constant overloads available, but eventually we might want to consider fixing those, too, just to get all of this code out of the business of manually remembering to pass around attributes and calling conventions. The test changes reflect the fact that we weren't really setting attributes consistently at all, in this case on value witnesses.
56 lines
2.2 KiB
Plaintext
56 lines
2.2 KiB
Plaintext
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %s -emit-ir | %FileCheck %s
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
// REQUIRES: objc_interop
|
|
|
|
import Builtin
|
|
|
|
// ObjC payloads can be nullable too.
|
|
enum NullableObjCRefcounted {
|
|
case Ref(Builtin.UnknownObject)
|
|
case None
|
|
}
|
|
// CHECK-LABEL: define linkonce_odr hidden void @_T039enum_value_semantics_special_cases_objc22NullableObjCRefcountedOwxx(%swift.opaque* noalias %object, %swift.type* %NullableObjCRefcounted) {{.*}} {
|
|
// CHECK: entry:
|
|
// CHECK: %0 = bitcast %swift.opaque* %object to %T39enum_value_semantics_special_cases_objc22NullableObjCRefcountedO*
|
|
// CHECK: %1 = bitcast %T39enum_value_semantics_special_cases_objc22NullableObjCRefcountedO* %0 to %objc_object**
|
|
// CHECK: %2 = load %objc_object*, %objc_object** %1, align 8
|
|
// CHECK: call void @swift_unknownRelease(%objc_object* %2) {{#[0-9]+}}
|
|
// CHECK: ret void
|
|
// CHECK: }
|
|
|
|
class C {}
|
|
sil_vtable C {}
|
|
|
|
sil @_T039enum_value_semantics_special_cases_objc1CCfD : $@convention(method) (C) -> ()
|
|
|
|
enum AllMixedRefcounted {
|
|
case Ref(Builtin.NativeObject)
|
|
case CRef(C)
|
|
case ORef(Builtin.UnknownObject)
|
|
case None
|
|
}
|
|
|
|
// CHECK-LABEL: define linkonce_odr hidden void @_T039enum_value_semantics_special_cases_objc18AllMixedRefcountedOwxx(%swift.opaque* noalias %object, %swift.type* %AllMixedRefcounted) {{.*}} {
|
|
// CHECK: entry:
|
|
// CHECK: %0 = bitcast %swift.opaque* %object to %T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO*
|
|
// CHECK: %1 = bitcast %T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO* %0 to i64*
|
|
// CHECK: %2 = load i64, i64* %1, align 8
|
|
// -- 0x3fffffffffffffff
|
|
// CHECK: %3 = and i64 %2, 4611686018427387903
|
|
// CHECK: %4 = inttoptr i64 %3 to %objc_object*
|
|
// CHECK: call void @swift_unknownRelease(%objc_object* %4) {{#[0-9]+}}
|
|
// CHECK: ret void
|
|
// CHECK: }
|
|
|
|
enum AllMixedRefcountedTwoSimple {
|
|
case Ref(Builtin.NativeObject)
|
|
case CRef(C)
|
|
case ORef(Builtin.UnknownObject)
|
|
case None
|
|
case Nothing
|
|
}
|
|
|
|
// CHECK-LABEL: define linkonce_odr hidden void @_T039enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOwxx
|
|
// CHECK: call void @_T039enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOWy
|