mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This patch removes the `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT` annotation while maintaining the support for `SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`. These type-level annotations were initially introduced in [PR-81093](https://github.com/swiftlang/swift/pull/81093) to reduce the annotation burden in large C++ codebases where many C++ APIs returning `SWIFT_SHARED_REFERENCE` types are exposed to Swift. ### Motivation The original goal was to make C++ interop more ergonomic by allowing type-level defaults for ownership conventions for`SWIFT_SHARED_REFERENCE` types . However, defaulting to retained return values (+1) seems to be problematic and poses memory safety risks. ### Why we’re removing `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT` - **Memory safety risks:** Defaulting to retained can potentially lead to use-after-free bugs when the API implementation actually returns `unowned` (`+0`). These errors are subtle and can be hard to debug or discover, particularly in the absence of explicit API-level `SWIFT_RETURNS_(UN)RETAINED` annotations. - **Risky transitive behavior:** If a `SWIFT_SHARED_REFERENCE` type is annotated with `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT`, any new C++ API returning this type will inherit the retained behavior by default—even if the API's actual return behavior is unretained. Unless explicitly overridden with `SWIFT_RETURNS_UNRETAINED`, this can introduce a silent mismatch in ownership expectations and lead to use-after-free bugs. This is especially risky in large or evolving codebases where such defaults may be overlooked. - **Simpler multiple inheritance semantics:** With only one type-level default (`SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`), we avoid complications that can arise when multiple base classes specify conflicting ownership defaults. This simplifies reasoning about behavior in class hierarchies and avoids ambiguity when Swift determines the ownership convention for inherited APIs. ### Why we’re keeping `SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT` - It still enables projects to suppress warnings for unannotated C++ APIs returning `SWIFT_SHARED_REFERENCE` types, helping to reduce noise while maintaining clarity. - It encourages explicitness for retained behavior. Developers must annotate retained return values with `SWIFT_RETURNS_RETAINED`, making ownership intent clearer and safer. - The worst-case outcome of assuming unretained when the return is actually retained is a memory leak, which is more tolerable and easier to debug than a use-after-free. - Having a single default mechanism improves clarity for documentation, diagnostics, and long-term maintenance of Swift/C++ interop code.
279 lines
18 KiB
Swift
279 lines
18 KiB
Swift
// RUN: %target-swift-emit-sil -I %S/Inputs -cxx-interoperability-mode=upcoming-swift -disable-availability-checking -diagnostic-style llvm %s -validate-tbd-against-ir=none -Xcc -fignore-exceptions | %FileCheck %s
|
|
|
|
import FunctionsAndMethodsReturningFRT
|
|
|
|
func testFriendFunctionsReturningFRT() {
|
|
let frtLocalVar1 = returnInstanceOfFRTStruct()
|
|
// CHECK: function_ref @{{.*}}returnInstanceOfFRTStruct{{.*}} : $@convention(c) () -> Optional<FRTStruct>
|
|
|
|
let frtLocalVar2 = returnInstanceOfFRTStructWithAttrReturnsRetained()
|
|
// CHECK: function_ref @{{.*}}returnInstanceOfFRTStructWithAttrReturnsRetained{{.*}} : $@convention(c) () -> @owned Optional<FRTStruct>
|
|
|
|
let frtLocalVar3 = returnInstanceOfFRTStructWithAttrReturnsUnretained()
|
|
// CHECK: function_ref @{{.*}}returnInstanceOfFRTStructWithAttrReturnsUnretained{{.*}} : $@convention(c) () -> Optional<FRTStruct>
|
|
}
|
|
|
|
func testFreeFunctionsWithoutAttrubutes() {
|
|
let frtLocalVar1 = global_function_returning_FRT()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
// Free/global functions having copy/create in the function name are passed as owned by default
|
|
let frtLocalVar2 = global_function_returning_copy()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar3 = global_function_returning_create()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_create{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar4 = global_function_returning_init()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_init{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar5 = global_function_returning_clone()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_clone{{.*}} : $@convention(c) () -> FRTStruct
|
|
}
|
|
|
|
func testFreeFunctionsWithAttrubuteReturnsRetained() {
|
|
let frtLocalVar1 = global_function_returning_FRT_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar2 = global_function_returning_copy_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar3 = global_function_returning_create_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_create_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar4 = global_function_returning_init_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_init_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar5 = global_function_returning_clone_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_clone_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
}
|
|
|
|
func testFreeFunctionsWithAttrubuteReturnsUnretained() {
|
|
let frtLocalVar1 = global_function_returning_FRT_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar2 = global_function_returning_copy_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar3 = global_function_returning_create_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_create_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar4 = global_function_returning_init_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_init_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar5 = global_function_returning_clone_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_clone_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
}
|
|
|
|
func testStaticFreeFunctions() {
|
|
let frtLocalVar1 = global_static_function_returning_FRT()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_FRT{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar2 = global_static_function_returning_FRT_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_FRT_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar3 = global_static_function_returning_FRT_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_FRT_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar4 = global_static_function_returning_copy()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_copy{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar5 = global_static_function_returning_create()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_create{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar6 = global_static_function_returning_copy_with_attr_returns_retained()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_copy_with_attr_returns_retained{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar7 = global_static_function_returning_copy_with_attr_returns_unretained()
|
|
// CHECK: function_ref @{{.*}}global_static_function_returning_copy_with_attr_returns_unretained{{.*}} : $@convention(c) () -> FRTStruct
|
|
}
|
|
|
|
// Testing Global/free C++ functions without _Nonnull
|
|
func testtFreeFunctionsWithoutNonnull() {
|
|
let frtLocalVar1 = global_function_returning_FRT_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT_wihout_Nonnull{{.*}} : $@convention(c) () -> Optional<FRTStruct>
|
|
|
|
let frtLocalVar2 = global_function_returning_FRT_with_attr_returns_retained_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT_with_attr_returns_retained_wihout_Nonnull{{.*}} : $@convention(c) () -> @owned Optional<FRTStruct>
|
|
|
|
let frtLocalVar3 = global_function_returning_FRT_with_attr_returns_unretained_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_FRT_with_attr_returns_unretained_wihout_Nonnull{{.*}} : $@convention(c) () -> Optional<FRTStruct>
|
|
|
|
let frtLocalVar4 = global_function_returning_copy_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy_wihout_Nonnull{{.*}} : $@convention(c) () -> @owned Optional<FRTStruct>
|
|
|
|
let frtLocalVar5 = global_function_returning_create_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_create_wihout_Nonnull{{.*}} : $@convention(c) () -> @owned Optional<FRTStruct>
|
|
|
|
let frtLocalVar6 = global_function_returning_copy_with_attr_returns_retained_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy_with_attr_returns_retained_wihout_Nonnull{{.*}} : $@convention(c) () -> @owned Optional<FRTStruct>
|
|
|
|
let frtLocalVar7 = global_function_returning_copy_with_attr_returns_unretained_wihout_Nonnull()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_copy_with_attr_returns_unretained_wihout_Nonnull{{.*}} : $@convention(c) () -> Optional<FRTStruct>
|
|
}
|
|
|
|
func testStaticMethodsWithoutAttrubutes() {
|
|
let frtLocalVar1 = StructWithStaticMethodsReturningFRTWithoutAttributes.StaticMethodReturningFRT()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar2 = StructWithStaticMethodsReturningFRTWithoutAttributes.StaticMethodReturningFRT_copy()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_copy{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar3 = StructWithStaticMethodsReturningFRTWithoutAttributes.StaticMethodReturningFRT_create()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_create{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar4 = StructWithStaticMethodsReturningFRTWithoutAttributes.StaticMethodReturningFRT_init()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_init{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar5 = StructWithStaticMethodsReturningFRTWithoutAttributes.StaticMethodReturningFRT_clone()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_clone{{.*}} : $@convention(c) () -> FRTStruct
|
|
}
|
|
|
|
func testStaticMethodsWithAttrubuteReturnsRetained() {
|
|
let frtLocalVar1 = StructWithStaticMethodsReturningFRTWithAttributeReturnsRetained.StaticMethodReturningFRT()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar2 = StructWithStaticMethodsReturningFRTWithAttributeReturnsRetained.StaticMethodReturningFRT_copy()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_copy{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar3 = StructWithStaticMethodsReturningFRTWithAttributeReturnsRetained.StaticMethodReturningFRT_create()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_create{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar4 = StructWithStaticMethodsReturningFRTWithAttributeReturnsRetained.StaticMethodReturningFRT_init()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_init{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
|
|
let frtLocalVar5 = StructWithStaticMethodsReturningFRTWithAttributeReturnsRetained.StaticMethodReturningFRT_clone()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_clone{{.*}} : $@convention(c) () -> @owned FRTStruct
|
|
}
|
|
|
|
func testStaticMethodsWithAttrubuteReturnsUnretained() {
|
|
let frtLocalVar1 = StructWithStaticMethodsReturningFRTWithAttributeReturnsUnretained.StaticMethodReturningFRT()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar2 = StructWithStaticMethodsReturningFRTWithAttributeReturnsUnretained.StaticMethodReturningFRT_copy()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_copy{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar3 = StructWithStaticMethodsReturningFRTWithAttributeReturnsUnretained.StaticMethodReturningFRT_create()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_create{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar4 = StructWithStaticMethodsReturningFRTWithAttributeReturnsUnretained.StaticMethodReturningFRT_init()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_init{{.*}} : $@convention(c) () -> FRTStruct
|
|
|
|
let frtLocalVar5 = StructWithStaticMethodsReturningFRTWithAttributeReturnsUnretained.StaticMethodReturningFRT_clone()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningFRT_clone{{.*}} : $@convention(c) () -> FRTStruct
|
|
}
|
|
|
|
func testFreeFunctionsReturningNonFRT() {
|
|
let frtLocalVar1 = global_function_returning_non_FRT()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_non_FRT{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
|
|
let frtLocalVar4 = global_function_returning_non_FRT_create()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_non_FRT_create{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
|
|
let frtLocalVar5 = global_function_returning_non_FRT_copy()
|
|
// CHECK: function_ref @{{.*}}global_function_returning_non_FRT_copy{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
}
|
|
|
|
func testStaticMethodsReturningNonFRT() {
|
|
let frtLocalVar1 = StructWithStaticMethodsReturningNonFRT.StaticMethodReturningNonFRT()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningNonFRT{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
|
|
let frtLocalVar4 = StructWithStaticMethodsReturningNonFRT.StaticMethodReturningNonFRT_create()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningNonFRT_create{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
|
|
let frtLocalVar5 = StructWithStaticMethodsReturningNonFRT.StaticMethodReturningNonFRT_copy()
|
|
// CHECK: function_ref @{{.*}}StaticMethodReturningNonFRT_copy{{.*}} : $@convention(c) () -> UnsafeMutablePointer<NonFRTStruct>
|
|
}
|
|
|
|
func testtFreeFunctionsTemplated(frt : FRTStruct, nonFrt: NonFRTStruct) {
|
|
let frtLocalVar1 : Int = 1;
|
|
|
|
let frtLocalVar2 = global_templated_function_returning_FRT(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar3 = global_templated_function_returning_FRT_copy(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_copy{{.*}} : $@convention(c) (Int) -> @owned FRTStruct
|
|
|
|
let frtLocalVar4 = global_templated_function_returning_FRT_create(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_create{{.*}} : $@convention(c) (Int) -> @owned FRTStruct
|
|
|
|
let frtLocalVar5 = global_templated_function_returning_FRT_init(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_init{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar6 = global_templated_function_returning_FRT_clone(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_clone{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar7 = global_templated_function_returning_FRT_with_attr_returns_retained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_with_attr_returns_retained{{.*}} : $@convention(c) (Int) -> @owned FRTStruct
|
|
|
|
let frtLocalVar8 = global_templated_function_returning_FRT_copy_with_attr_returns_retained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_copy_with_attr_returns_retained{{.*}} : $@convention(c) (Int) -> @owned FRTStruct
|
|
|
|
let frtLocalVar9 = global_templated_function_returning_FRT_create_with_attr_returns_retained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_create_with_attr_returns_retained{{.*}} : $@convention(c) (Int) -> @owned FRTStruct
|
|
|
|
let frtLocalVar10 = global_templated_function_returning_FRT_with_attr_returns_unretained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_with_attr_returns_unretained{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar11 = global_templated_function_returning_FRT_copy_with_attr_returns_unretained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_copy_with_attr_returns_unretained{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar12 = global_templated_function_returning_FRT_create_with_attr_returns_unretained(frtLocalVar1)
|
|
// CHECK: function_ref @{{.*}}global_templated_function_returning_FRT_create_with_attr_returns_unretained{{.*}} : $@convention(c) (Int) -> FRTStruct
|
|
|
|
let frtLocalVar13 = global_function_returning_templated_retrun_frt(frt)
|
|
// CHECK: function_ref @{{.*}}global_function_returning_templated_retrun_frt{{.*}} : $@convention(c) (FRTStruct) -> FRTStruct
|
|
|
|
let frtLocalVar14 = global_function_returning_templated_retrun_frt_owned(frt)
|
|
// CHECK: function_ref @{{.*}}global_function_returning_templated_retrun_frt_owned{{.*}} : $@convention(c) (FRTStruct) -> @owned FRTStruct
|
|
|
|
let nonFrtLocalVar1 = global_function_returning_templated_retrun_frt_owned(nonFrt)
|
|
// CHECK: function_ref @{{.*}}global_function_returning_templated_retrun_frt_owned{{.*}} : $@convention(c) (NonFRTStruct) -> NonFRTStruct
|
|
}
|
|
|
|
func testVirtualMethods(base: Base, derived: Derived) {
|
|
var mutableBase = base
|
|
var mutableDerived = derived
|
|
|
|
var frt1 = mutableBase.VirtualMethodReturningFRTUnowned()
|
|
// CHECK: function_ref @{{.*}}VirtualMethodReturningFRTUnowned{{.*}} : $@convention(cxx_method) (@inout Base) -> FRTStruct
|
|
|
|
var frt2 = mutableDerived.VirtualMethodReturningFRTUnowned()
|
|
// CHECK: function_ref @{{.*}}VirtualMethodReturningFRTUnowned{{.*}} : $@convention(cxx_method) (@inout Derived) -> FRTStruct
|
|
|
|
var frt3 = mutableBase.VirtualMethodReturningFRTOwned()
|
|
// CHECK: function_ref @{{.*}}VirtualMethodReturningFRTOwned{{.*}} : $@convention(cxx_method) (@inout Base) -> @owned FRTStruct
|
|
|
|
var frt4 = mutableDerived.VirtualMethodReturningFRTOwned()
|
|
// CHECK: function_ref @{{.*}}VirtualMethodReturningFRTOwned{{.*}} : $@convention(cxx_method) (@inout Derived) -> @owned FRTStruct
|
|
}
|
|
|
|
func testDefaultOwnershipAnnotation() {
|
|
let _ = DefaultOwnershipConventionOnCXXForeignRefType.returnRefTyDefUnretained()
|
|
// CHECK: function_ref {{.*}}returnRefTyDefUnretained{{.*}} : $@convention(c) () -> DefaultOwnershipConventionOnCXXForeignRefType.RefTyDefUnretained
|
|
|
|
let _ = FunctionAnnotationHasPrecedence.returnRefTyDefUnretained()
|
|
// CHECK: function_ref {{.*}}returnRefTyDefUnretained{{.*}} : $@convention(c) () -> FunctionAnnotationHasPrecedence.RefTyDefUnretained
|
|
|
|
let _ = FunctionAnnotationHasPrecedence.returnRefTyDefUnretainedAnnotatedRetained()
|
|
// CHECK: function_ref {{.*}}returnRefTyDefUnretainedAnnotatedRetained{{.*}} : $@convention(c) () -> @owned FunctionAnnotationHasPrecedence.RefTyDefUnretained
|
|
|
|
let _ = DefaultOwnershipInheritance.createBaseType()
|
|
// CHECK: function_ref {{.*}}createBaseType{{.*}} : $@convention(c) () -> DefaultOwnershipInheritance.BaseType
|
|
|
|
let _ = DefaultOwnershipInheritance.createDerivedType()
|
|
// CHECK: function_ref {{.*}}createDerivedType{{.*}} : $@convention(c) () -> DefaultOwnershipInheritance.DerivedType
|
|
|
|
let _ = DefaultOwnershipInheritance.createDerivedType2()
|
|
// CHECK: function_ref {{.*}}createDerivedType2{{.*}} : $@convention(c) () -> DefaultOwnershipInheritance.DerivedType2
|
|
|
|
let _ = DefaultOwnershipInheritance.createBaseTypeNonDefault()
|
|
// CHECK: function_ref {{.*}}createBaseTypeNonDefault{{.*}} : $@convention(c) () -> @owned DefaultOwnershipInheritance.BaseTypeNonDefault
|
|
|
|
let _ = DefaultOwnershipInheritance.createDerivedTypeNonDefault()
|
|
// CHECK: function_ref {{.*}}createDerivedTypeNonDefault{{.*}} : $@convention(c) () -> @owned DefaultOwnershipInheritance.DerivedTypeNonDefault
|
|
|
|
let _ = DefaultOwnershipInheritance.createDerivedTypeNonDefaultUnretained()
|
|
// CHECK: function_ref {{.*}}createDerivedTypeNonDefaultUnretained{{.*}} : $@convention(c) () -> DefaultOwnershipInheritance.DerivedTypeNonDefault
|
|
}
|