mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
_SwiftifyImport doesn't know how to handle AutoreleasingUnsafeMutablePointer, so we should not attach any .countedBy information for pointers that are imported as this type. This also adds defensive checks against adding .countedBy to any pointer type that _SwiftifyImport doesn't know how to transform. rdar://151479521
22 lines
1.3 KiB
Swift
22 lines
1.3 KiB
Swift
// REQUIRES: swift_feature_SafeInteropWrappers
|
|
|
|
// RUN: %target-swift-ide-test -print-module -module-to-print=NoSwiftifyClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers | %FileCheck %s
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/NoSwiftify.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers %s -verify -verify-additional-file %S/Inputs/objc-no-swiftify.h
|
|
|
|
import NoSwiftifyClang
|
|
|
|
// CHECK-NOT: @_alwaysEmitIntoClient public func callAutoreleaseParam
|
|
// CHECK-NOT: @_alwaysEmitIntoClient public func callAutoreleaseReturn
|
|
|
|
public func callAutoreleaseParam(_ p: UnsafeMutableBufferPointer<SomeClass>) {
|
|
// expected-error@+2{{missing argument for parameter #2 in call}}
|
|
// expected-error@+1{{cannot convert value of type 'UnsafeMutableBufferPointer<SomeClass>' to expected argument type 'AutoreleasingUnsafeMutablePointer<SomeClass?>'}}
|
|
autoreleaseParam(p)
|
|
}
|
|
|
|
public func callAutoreleaseReturn() {
|
|
// expected-error@+1{{cannot convert value of type 'AutoreleasingUnsafeMutablePointer<SomeClass?>?' to specified type 'UnsafeMutableBufferPointer<SomeClass>'}}
|
|
let p: UnsafeMutableBufferPointer<SomeClass> = autoreleaseReturn(10)
|
|
} |