Skip to content

Commit ef1050f

Browse files
moiseevMaxim Moiseev
authored andcommitted
[stdlib] Audit inlinability in BridgeObjectiveC
<rdar://problem/45949961>
1 parent a1ae75b commit ef1050f

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public struct _BridgeableMetatype: _ObjectiveCBridgeable {
139139

140140
//===--- Bridging facilities written in Objective-C -----------------------===//
141141
// Functions that must discover and possibly use an arbitrary type's
142-
// conformance to a given protocol. See ../runtime/Metadata.cpp for
142+
// conformance to a given protocol. See ../runtime/Casting.cpp for
143143
// implementations.
144144
//===----------------------------------------------------------------------===//
145145

@@ -156,8 +156,8 @@ public struct _BridgeableMetatype: _ObjectiveCBridgeable {
156156
/// that is `id`-compatible and dynamically castable back to the type of
157157
/// the boxed value, but is otherwise opaque.
158158
///
159-
/// COMPILER_INTRINSIC
160-
@inlinable // FIXME(sil-serialize-all)
159+
// COMPILER_INTRINSIC
160+
@inlinable
161161
public func _bridgeAnythingToObjectiveC<T>(_ x: T) -> AnyObject {
162162
if _fastPath(_isClassOrObjCExistential(T.self)) {
163163
return unsafeBitCast(x, to: AnyObject.self)
@@ -166,16 +166,16 @@ public func _bridgeAnythingToObjectiveC<T>(_ x: T) -> AnyObject {
166166
}
167167

168168
@_silgen_name("")
169-
public func _bridgeAnythingNonVerbatimToObjectiveC<T>(_ x: __owned T) -> AnyObject
169+
public // @testable
170+
func _bridgeAnythingNonVerbatimToObjectiveC<T>(_ x: __owned T) -> AnyObject
170171

171172
/// Convert a purportedly-nonnull `id` value from Objective-C into an Any.
172173
///
173174
/// Since Objective-C APIs sometimes get their nullability annotations wrong,
174175
/// this includes a failsafe against nil `AnyObject`s, wrapping them up as
175176
/// a nil `AnyObject?`-inside-an-`Any`.
176177
///
177-
/// COMPILER_INTRINSIC
178-
@inlinable // FIXME(sil-serialize-all)
178+
// COMPILER_INTRINSIC
179179
public func _bridgeAnyObjectToAny(_ possiblyNullObject: AnyObject?) -> Any {
180180
if let nonnullObject = possiblyNullObject {
181181
return nonnullObject // AnyObject-in-Any
@@ -194,7 +194,7 @@ public func _bridgeAnyObjectToAny(_ possiblyNullObject: AnyObject?) -> Any {
194194
/// or a subclass of it, trap;
195195
/// + otherwise, returns the result of `T._forceBridgeFromObjectiveC(x)`;
196196
/// - otherwise, trap.
197-
@inlinable // FIXME(sil-serialize-all)
197+
@inlinable
198198
public func _forceBridgeFromObjectiveC<T>(_ x: AnyObject, _: T.Type) -> T {
199199
if _fastPath(_isClassOrObjCExistential(T.self)) {
200200
return x as! T
@@ -207,8 +207,8 @@ public func _forceBridgeFromObjectiveC<T>(_ x: AnyObject, _: T.Type) -> T {
207207

208208
/// Convert `x` from its Objective-C representation to its Swift
209209
/// representation.
210-
/// COMPILER_INTRINSIC
211-
@inlinable // FIXME(sil-serialize-all)
210+
// COMPILER_INTRINSIC
211+
@inlinable
212212
public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
213213
_ x: T._ObjectiveCType,
214214
_: T.Type
@@ -230,7 +230,7 @@ public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
230230
/// + otherwise, returns the result of
231231
/// `T._conditionallyBridgeFromObjectiveC(x)`;
232232
/// - otherwise, the result is empty.
233-
@inlinable // FIXME(sil-serialize-all)
233+
@inlinable
234234
public func _conditionallyBridgeFromObjectiveC<T>(
235235
_ x: AnyObject,
236236
_: T.Type
@@ -246,8 +246,8 @@ public func _conditionallyBridgeFromObjectiveC<T>(
246246

247247
/// Attempt to convert `x` from its Objective-C representation to its Swift
248248
/// representation.
249-
/// COMPILER_INTRINSIC
250-
@inlinable // FIXME(sil-serialize-all)
249+
// COMPILER_INTRINSIC
250+
@inlinable
251251
public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(
252252
_ x: T._ObjectiveCType,
253253
_: T.Type
@@ -258,7 +258,8 @@ public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeabl
258258
}
259259

260260
@_silgen_name("")
261-
public func _bridgeNonVerbatimFromObjectiveC<T>(
261+
@usableFromInline
262+
internal func _bridgeNonVerbatimFromObjectiveC<T>(
262263
_ x: AnyObject,
263264
_ nativeType: T.Type,
264265
_ result: inout T?
@@ -558,8 +559,8 @@ public func _getObjCTypeEncoding<T>(_ type: T.Type) -> UnsafePointer<Int8> {
558559

559560
/// Convert `x` from its Objective-C representation to its Swift
560561
/// representation.
561-
/// COMPILER_INTRINSIC
562-
@inlinable // FIXME(sil-serialize-all)
562+
// COMPILER_INTRINSIC
563+
@inlinable
563564
public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
564565
_ x: T._ObjectiveCType,
565566
_: T.Type
@@ -571,8 +572,8 @@ public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
571572

572573
/// Attempt to convert `x` from its Objective-C representation to its Swift
573574
/// representation.
574-
/// COMPILER_INTRINSIC
575-
@inlinable // FIXME(sil-serialize-all)
575+
// COMPILER_INTRINSIC
576+
@inlinable
576577
public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(
577578
_ x: T._ObjectiveCType,
578579
_: T.Type
@@ -692,7 +693,7 @@ func _makeSwiftValue(_ value: Any) -> AnyObject {
692693
/// that is `id`-compatible and dynamically castable back to the type of
693694
/// the boxed value, but is otherwise opaque.
694695
///
695-
/// COMPILER_INTRINSIC
696+
// COMPILER_INTRINSIC
696697
public func _bridgeAnythingToObjectiveC<T>(_ x: T) -> AnyObject {
697698
var done = false
698699
var result: AnyObject!

0 commit comments

Comments
 (0)