Skip to content

Commit 371630b

Browse files
committed
[Swiftify] Always annotate overloads with @_disfavoredOverload
Previously we would only add @_disfavoredOverload if the only type changed was the return type, because in any other case it is unambiguous which overload to call. However it is still ambiguous when storing the function as a value rather than calling the function, unless explicit type annotations are used. To avoid breaking any existing code, this patch adds @_disfavoredOverload to every overload generated by @_SwiftifyImport. rdar://151206394
1 parent 98c3993 commit 371630b

40 files changed

+152
-143
lines changed

lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,8 @@ func isMutablePointerType(_ type: TypeSyntax) -> Bool {
389389
protocol BoundsCheckedThunkBuilder {
390390
func buildFunctionCall(_ pointerArgs: [Int: ExprSyntax]) throws -> ExprSyntax
391391
func buildBoundsChecks() throws -> [CodeBlockItemSyntax.Item]
392-
// The second component of the return value is true when only the return type of the
393-
// function signature was changed.
394392
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
395-
-> (FunctionSignatureSyntax, Bool)
393+
-> FunctionSignatureSyntax
396394
}
397395

398396
func getParam(_ signature: FunctionSignatureSyntax, _ paramIndex: Int) -> FunctionParameterSyntax {
@@ -420,7 +418,7 @@ struct FunctionCallBuilder: BoundsCheckedThunkBuilder {
420418
}
421419

422420
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
423-
-> (FunctionSignatureSyntax, Bool)
421+
-> FunctionSignatureSyntax
424422
{
425423
var newParams = base.signature.parameterClause.parameters.enumerated().filter {
426424
let type = argTypes[$0.offset]
@@ -443,7 +441,7 @@ struct FunctionCallBuilder: BoundsCheckedThunkBuilder {
443441
if returnType != nil {
444442
sig = sig.with(\.returnClause!.type, returnType!)
445443
}
446-
return (sig, (argTypes.count == 0 && returnType != nil))
444+
return sig
447445
}
448446

449447
func buildFunctionCall(_ pointerArgs: [Int: ExprSyntax]) throws -> ExprSyntax {
@@ -493,7 +491,7 @@ struct CxxSpanThunkBuilder: SpanBoundsThunkBuilder, ParamBoundsThunkBuilder {
493491
}
494492

495493
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
496-
-> (FunctionSignatureSyntax, Bool)
494+
-> FunctionSignatureSyntax
497495
{
498496
var types = argTypes
499497
types[index] = try newType
@@ -543,7 +541,7 @@ struct CxxSpanReturnThunkBuilder: SpanBoundsThunkBuilder {
543541
}
544542

545543
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
546-
-> (FunctionSignatureSyntax, Bool)
544+
-> FunctionSignatureSyntax
547545
{
548546
assert(returnType == nil)
549547
return try base.buildFunctionSignature(argTypes, newType)
@@ -680,7 +678,7 @@ struct CountedOrSizedReturnPointerThunkBuilder: PointerBoundsThunkBuilder {
680678
}
681679

682680
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
683-
-> (FunctionSignatureSyntax, Bool)
681+
-> FunctionSignatureSyntax
684682
{
685683
assert(returnType == nil)
686684
return try base.buildFunctionSignature(argTypes, newType)
@@ -739,7 +737,7 @@ struct CountedOrSizedPointerThunkBuilder: ParamBoundsThunkBuilder, PointerBounds
739737
var generateSpan: Bool { nonescaping }
740738

741739
func buildFunctionSignature(_ argTypes: [Int: TypeSyntax?], _ returnType: TypeSyntax?) throws
742-
-> (FunctionSignatureSyntax, Bool)
740+
-> FunctionSignatureSyntax
743741
{
744742
var types = argTypes
745743
types[index] = try newType
@@ -1502,7 +1500,7 @@ public struct SwiftifyImportMacro: PeerMacro {
15021500
{ (prev, parsedArg) in
15031501
parsedArg.getBoundsCheckedThunkBuilder(prev, funcDecl, skipTrivialCount)
15041502
})
1505-
let (newSignature, onlyReturnTypeChanged) = try builder.buildFunctionSignature([:], nil)
1503+
let newSignature = try builder.buildFunctionSignature([:], nil)
15061504
let checks =
15071505
skipTrivialCount
15081506
? [] as [CodeBlockItemSyntax]
@@ -1520,13 +1518,12 @@ public struct SwiftifyImportMacro: PeerMacro {
15201518
returnLifetimeAttribute + paramLifetimeAttributes(newSignature, funcDecl.attributes)
15211519
let availabilityAttr = try getAvailability(newSignature, spanAvailability)
15221520
let disfavoredOverload: [AttributeListSyntax.Element] =
1523-
(onlyReturnTypeChanged
1524-
? [
1525-
.attribute(
1526-
AttributeSyntax(
1527-
atSign: .atSignToken(),
1528-
attributeName: IdentifierTypeSyntax(name: "_disfavoredOverload")))
1529-
] : [])
1521+
[
1522+
.attribute(
1523+
AttributeSyntax(
1524+
atSign: .atSignToken(),
1525+
attributeName: IdentifierTypeSyntax(name: "_disfavoredOverload")))
1526+
]
15301527
let newFunc =
15311528
funcDecl
15321529
.with(\.signature, newSignature)

test/Interop/C/swiftify-import/comments.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// CHECK-NEXT:func blockDocComment(_ len: Int32, _ p: UnsafeMutablePointer<Int32>!)
2828

2929
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
30-
// CHECK-NEXT:@_alwaysEmitIntoClient public func blockComment(_ p: UnsafeMutableBufferPointer<Int32>)
30+
// CHECK-NEXT:@_alwaysEmitIntoClient @_disfavoredOverload public func blockComment(_ p: UnsafeMutableBufferPointer<Int32>)
3131

3232
// CHECK-NEXT:/**
3333
// CHECK-NEXT: * block doc comment
@@ -37,10 +37,10 @@
3737
// CHECK-NEXT: * @param p some integers to play with
3838
// CHECK-NEXT: */
3939
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
40-
// CHECK-NEXT:@_alwaysEmitIntoClient public func blockDocComment(_ p: UnsafeMutableBufferPointer<Int32>)
40+
// CHECK-NEXT:@_alwaysEmitIntoClient @_disfavoredOverload public func blockDocComment(_ p: UnsafeMutableBufferPointer<Int32>)
4141

4242
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
43-
// CHECK-NEXT:@_alwaysEmitIntoClient public func lineComment(_ p: UnsafeMutableBufferPointer<Int32>)
43+
// CHECK-NEXT:@_alwaysEmitIntoClient @_disfavoredOverload public func lineComment(_ p: UnsafeMutableBufferPointer<Int32>)
4444

4545
// CHECK-NEXT:/// line doc comment
4646
// CHECK-NEXT:///
@@ -49,4 +49,4 @@
4949
// CHECK-NEXT:/// @param len the buffer length
5050
// CHECK-NEXT:/// @param p the buffer
5151
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
52-
// CHECK-NEXT:@_alwaysEmitIntoClient public func lineDocComment(_ p: UnsafeMutableBufferPointer<Int32>)
52+
// CHECK-NEXT:@_alwaysEmitIntoClient @_disfavoredOverload public func lineDocComment(_ p: UnsafeMutableBufferPointer<Int32>)

test/Interop/C/swiftify-import/counted-by-noescape.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ import CountedByNoEscapeClang
1414
// CHECK: /// This is an auto-generated wrapper for safer interop
1515
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
1616
// CHECK-NEXT: @lifetime(_param1: copy _param1)
17-
// CHECK-NEXT: @_alwaysEmitIntoClient public func anonymous(_ _param1: inout MutableSpan<Int32>?)
17+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func anonymous(_ _param1: inout MutableSpan<Int32>?)
1818

1919
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
2020
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
2121
// CHECK-NEXT: @lifetime(p: copy p)
22-
// CHECK-NEXT: @_alwaysEmitIntoClient public func complexExpr(_ len: Int32, _ offset: Int32, _ p: inout MutableSpan<Int32>)
22+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func complexExpr(_ len: Int32, _ offset: Int32, _ p: inout MutableSpan<Int32>)
2323

2424
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
2525
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
2626
// CHECK-NEXT: @lifetime(p: copy p)
27-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nonnull(_ p: inout MutableSpan<Int32>)
27+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nonnull(_ p: inout MutableSpan<Int32>)
2828

2929
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3030
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
3131
// CHECK-NEXT: @lifetime(p: copy p)
32-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullUnspecified(_ p: inout MutableSpan<Int32>)
32+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullUnspecified(_ p: inout MutableSpan<Int32>)
3333

3434
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3535
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
3636
// CHECK-NEXT: @lifetime(p: copy p)
37-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullable(_ p: inout MutableSpan<Int32>?)
37+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullable(_ p: inout MutableSpan<Int32>?)
3838

3939
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
4040
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
4141
// CHECK-NEXT: @lifetime(copy p)
4242
// CHECK-NEXT: @lifetime(p: copy p)
43-
// CHECK-NEXT: @_alwaysEmitIntoClient public func returnLifetimeBound(_ len1: Int32, _ p: inout MutableSpan<Int32>) -> MutableSpan<Int32>
43+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func returnLifetimeBound(_ len1: Int32, _ p: inout MutableSpan<Int32>) -> MutableSpan<Int32>
4444

4545
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
4646
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func returnPointer(_ len: Int32) -> UnsafeMutableBufferPointer<Int32>
@@ -49,17 +49,17 @@ import CountedByNoEscapeClang
4949
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
5050
// CHECK-NEXT: @lifetime(p1: copy p1)
5151
// CHECK-NEXT: @lifetime(p2: copy p2)
52-
// CHECK-NEXT: @_alwaysEmitIntoClient public func shared(_ len: Int32, _ p1: inout MutableSpan<Int32>, _ p2: inout MutableSpan<Int32>)
52+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func shared(_ len: Int32, _ p1: inout MutableSpan<Int32>, _ p2: inout MutableSpan<Int32>)
5353

5454
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
5555
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
5656
// CHECK-NEXT: @lifetime(p: copy p)
57-
// CHECK-NEXT: @_alwaysEmitIntoClient public func simple(_ p: inout MutableSpan<Int32>)
57+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func simple(_ p: inout MutableSpan<Int32>)
5858

5959
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
6060
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
6161
// CHECK-NEXT: @lifetime(p: copy p)
62-
// CHECK-NEXT: @_alwaysEmitIntoClient public func swiftAttr(_ p: inout MutableSpan<Int32>)
62+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func swiftAttr(_ p: inout MutableSpan<Int32>)
6363

6464
@available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
6565
@lifetime(p: copy p)

test/Interop/C/swiftify-import/counted-by.swift

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,58 @@ import CountedByClang
1212

1313

1414
// CHECK: /// This is an auto-generated wrapper for safer interop
15-
// CHECK-NEXT: @_alwaysEmitIntoClient public func bitshift(_ m: Int32, _ n: Int32, _ o: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
15+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func bitshift(_ m: Int32, _ n: Int32, _ o: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
1616

1717
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
18-
// CHECK-NEXT: @_alwaysEmitIntoClient public func bitwise(_ m: Int32, _ n: Int32, _ o: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
18+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func bitwise(_ m: Int32, _ n: Int32, _ o: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
1919

2020
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
21-
// CHECK-NEXT: @_alwaysEmitIntoClient public func complexExpr(_ len: Int{{.*}}, _ offset: Int{{.*}}, _ p: UnsafeMutableBufferPointer<Int{{.*}}>)
21+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func complexExpr(_ len: Int{{.*}}, _ offset: Int{{.*}}, _ p: UnsafeMutableBufferPointer<Int{{.*}}>)
2222

2323
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
24-
// CHECK-NEXT: @_alwaysEmitIntoClient public func constFloatCastedToInt(_ p: UnsafeMutableBufferPointer<Int32>)
24+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func constFloatCastedToInt(_ p: UnsafeMutableBufferPointer<Int32>)
2525

2626
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
27-
// CHECK-NEXT: @_alwaysEmitIntoClient public func constInt(_ p: UnsafeMutableBufferPointer<Int32>)
27+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func constInt(_ p: UnsafeMutableBufferPointer<Int32>)
2828

2929
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
30-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nonnull(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
30+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nonnull(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
3131

3232
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
33-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullUnspecified(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
33+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullUnspecified(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
3434

3535
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
36-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullable(_ p: UnsafeMutableBufferPointer<Int{{.*}}>?)
36+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullable(_ p: UnsafeMutableBufferPointer<Int{{.*}}>?)
3737

3838
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
39-
// CHECK-NEXT: @_alwaysEmitIntoClient public func offByOne(_ len: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
39+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func offByOne(_ len: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
4040

4141
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
42-
// CHECK-NEXT: @_alwaysEmitIntoClient public func offBySome(_ len: Int32, _ offset: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
42+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func offBySome(_ len: Int32, _ offset: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
4343

4444
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
4545
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func returnPointer(_ len: Int{{.*}}) -> UnsafeMutableBufferPointer<Int{{.*}}>
4646

4747
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
48-
// CHECK-NEXT: @_alwaysEmitIntoClient public func scalar(_ m: Int32, _ n: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
48+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func scalar(_ m: Int32, _ n: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
4949

5050
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
51-
// CHECK-NEXT: @_alwaysEmitIntoClient public func shared(_ len: Int{{.*}}, _ p1: UnsafeMutableBufferPointer<Int{{.*}}>, _ p2: UnsafeMutableBufferPointer<Int{{.*}}>)
51+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func shared(_ len: Int{{.*}}, _ p1: UnsafeMutableBufferPointer<Int{{.*}}>, _ p2: UnsafeMutableBufferPointer<Int{{.*}}>)
5252

5353
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
54-
// CHECK-NEXT: @_alwaysEmitIntoClient public func simple(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
54+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func simple(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
5555

5656
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
57-
// CHECK-NEXT: @_alwaysEmitIntoClient public func simpleFlipped(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
57+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func simpleFlipped(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
5858

5959
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
60-
// CHECK-NEXT: @_alwaysEmitIntoClient public func sizeofParam(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
60+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func sizeofParam(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
6161

6262
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
63-
// CHECK-NEXT: @_alwaysEmitIntoClient public func sizeofType(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
63+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func sizeofType(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
6464

6565
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
66-
// CHECK-NEXT: @_alwaysEmitIntoClient public func swiftAttr(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
66+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func swiftAttr(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
6767

6868
@inlinable
6969
public func callComplexExpr(_ p: UnsafeMutableBufferPointer<CInt>) {
@@ -116,6 +116,18 @@ public func callSimple(_ p: UnsafeMutableBufferPointer<CInt>) {
116116
simple(p)
117117
}
118118

119+
@inlinable
120+
public func callSimpleIndirectOriginal(_ p: UnsafeMutablePointer<CInt>) {
121+
let f = simple
122+
f(13, p)
123+
}
124+
125+
@inlinable
126+
public func callSimpleIndirectOverload(_ p: UnsafeMutableBufferPointer<CInt>) {
127+
let f: (UnsafeMutableBufferPointer<CInt>) -> Void = simple
128+
f(p)
129+
}
130+
119131
@inlinable
120132
public func callSimpleFlipped(_ p: UnsafeMutableBufferPointer<CInt>) {
121133
simpleFlipped(p)
@@ -124,4 +136,4 @@ public func callSimpleFlipped(_ p: UnsafeMutableBufferPointer<CInt>) {
124136
@inlinable
125137
public func callSwiftAttr(_ p: UnsafeMutableBufferPointer<CInt>) {
126138
swiftAttr(p)
127-
}
139+
}

test/Interop/C/swiftify-import/sized-by-noescape.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@ import SizedByNoEscapeClang
1212

1313
// CHECK: /// This is an auto-generated wrapper for safer interop
1414
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
15-
// CHECK-NEXT: @_alwaysEmitIntoClient public func complexExpr(_ len: Int{{.*}}, _ offset: Int{{.*}}, _ p: RawSpan)
15+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func complexExpr(_ len: Int{{.*}}, _ offset: Int{{.*}}, _ p: RawSpan)
1616

1717
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
1818
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
19-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nonnull(_ p: RawSpan)
19+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nonnull(_ p: RawSpan)
2020

2121
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
2222
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
23-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullUnspecified(_ p: RawSpan)
23+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullUnspecified(_ p: RawSpan)
2424

2525
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
2626
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
27-
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullable(_ p: RawSpan?)
27+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullable(_ p: RawSpan?)
2828

2929
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3030
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
31-
// CHECK-NEXT: @_alwaysEmitIntoClient public func opaque(_ p: RawSpan)
31+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func opaque(_ p: RawSpan)
3232

3333
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3434
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func returnPointer(_ len: Int{{.*}}) -> UnsafeRawBufferPointer
3535

3636
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3737
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
38-
// CHECK-NEXT: @_alwaysEmitIntoClient public func shared(_ len: Int{{.*}}, _ p1: RawSpan, _ p2: RawSpan)
38+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func shared(_ len: Int{{.*}}, _ p1: RawSpan, _ p2: RawSpan)
3939

4040
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
4141
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
42-
// CHECK-NEXT: @_alwaysEmitIntoClient public func simple(_ p: RawSpan)
42+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func simple(_ p: RawSpan)
4343

4444
// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
4545
// CHECK-NEXT: @available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
46-
// CHECK-NEXT: @_alwaysEmitIntoClient public func swiftAttr(_ p: RawSpan)
46+
// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func swiftAttr(_ p: RawSpan)
4747

4848
@available(visionOS 1.1, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *)
4949
@inlinable

0 commit comments

Comments
 (0)