mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Explanation: We did not have support to generate swiftified overload for initializers. This PR adds that support. Issue: rdar://152112660 Risk: Low, the feature is localized to swiftified overloads. Testing: Regression test added. Original PR: #81947 Reviewer: @hnrklssn
31 lines
1.0 KiB
Swift
31 lines
1.0 KiB
Swift
// REQUIRES: swift_feature_SafeInteropWrappers
|
|
|
|
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
// RUN: %target-swift-ide-test -plugin-path %swift-plugin-dir -I %t/Inputs -cxx-interoperability-mode=upcoming-swift -enable-experimental-feature SafeInteropWrappers -print-module -module-to-print=Method -source-filename=x | %FileCheck %s
|
|
// RUN: %target-swift-frontend -plugin-path %swift-plugin-dir -I %t/Inputs -cxx-interoperability-mode=default -enable-experimental-feature SafeInteropWrappers %t/method.swift -dump-macro-expansions -typecheck -verify
|
|
|
|
// CHECK: @_alwaysEmitIntoClient
|
|
// CHECK-SAME: public mutating func bar(_ p: UnsafeMutableBufferPointer<Float>)
|
|
|
|
//--- Inputs/module.modulemap
|
|
module Method {
|
|
header "method.h"
|
|
requires cplusplus
|
|
}
|
|
|
|
//--- Inputs/method.h
|
|
|
|
class Foo {
|
|
public:
|
|
__attribute__((swift_attr("@_SwiftifyImport(.countedBy(pointer: .param(1), count: \"len\"))"))) void bar(float *p, int len);
|
|
};
|
|
|
|
//--- method.swift
|
|
import Method
|
|
|
|
func test(s: UnsafeMutableBufferPointer<Float>) {
|
|
var foo = Foo()
|
|
foo.bar(s)
|
|
}
|