Skip to content

Commit 70700cf

Browse files
committed
[stdlib] Audit inlinability in BridgeObjectiveC
<rdar://problem/45949961>
1 parent a1ae75b commit 70700cf

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 20 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,17 @@ 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
179+
@inlinable
179180
public func _bridgeAnyObjectToAny(_ possiblyNullObject: AnyObject?) -> Any {
180181
if let nonnullObject = possiblyNullObject {
181182
return nonnullObject // AnyObject-in-Any
@@ -194,7 +195,7 @@ public func _bridgeAnyObjectToAny(_ possiblyNullObject: AnyObject?) -> Any {
194195
/// or a subclass of it, trap;
195196
/// + otherwise, returns the result of `T._forceBridgeFromObjectiveC(x)`;
196197
/// - otherwise, trap.
197-
@inlinable // FIXME(sil-serialize-all)
198+
@inlinable
198199
public func _forceBridgeFromObjectiveC<T>(_ x: AnyObject, _: T.Type) -> T {
199200
if _fastPath(_isClassOrObjCExistential(T.self)) {
200201
return x as! T
@@ -207,8 +208,8 @@ public func _forceBridgeFromObjectiveC<T>(_ x: AnyObject, _: T.Type) -> T {
207208

208209
/// Convert `x` from its Objective-C representation to its Swift
209210
/// representation.
210-
/// COMPILER_INTRINSIC
211-
@inlinable // FIXME(sil-serialize-all)
211+
// COMPILER_INTRINSIC
212+
@inlinable
212213
public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
213214
_ x: T._ObjectiveCType,
214215
_: T.Type
@@ -230,7 +231,7 @@ public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
230231
/// + otherwise, returns the result of
231232
/// `T._conditionallyBridgeFromObjectiveC(x)`;
232233
/// - otherwise, the result is empty.
233-
@inlinable // FIXME(sil-serialize-all)
234+
@inlinable
234235
public func _conditionallyBridgeFromObjectiveC<T>(
235236
_ x: AnyObject,
236237
_: T.Type
@@ -246,8 +247,8 @@ public func _conditionallyBridgeFromObjectiveC<T>(
246247

247248
/// Attempt to convert `x` from its Objective-C representation to its Swift
248249
/// representation.
249-
/// COMPILER_INTRINSIC
250-
@inlinable // FIXME(sil-serialize-all)
250+
// COMPILER_INTRINSIC
251+
@inlinable
251252
public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(
252253
_ x: T._ObjectiveCType,
253254
_: T.Type
@@ -258,7 +259,8 @@ public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeabl
258259
}
259260

260261
@_silgen_name("")
261-
public func _bridgeNonVerbatimFromObjectiveC<T>(
262+
@usableFromInline
263+
internal func _bridgeNonVerbatimFromObjectiveC<T>(
262264
_ x: AnyObject,
263265
_ nativeType: T.Type,
264266
_ result: inout T?
@@ -558,8 +560,8 @@ public func _getObjCTypeEncoding<T>(_ type: T.Type) -> UnsafePointer<Int8> {
558560

559561
/// Convert `x` from its Objective-C representation to its Swift
560562
/// representation.
561-
/// COMPILER_INTRINSIC
562-
@inlinable // FIXME(sil-serialize-all)
563+
// COMPILER_INTRINSIC
564+
@inlinable
563565
public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
564566
_ x: T._ObjectiveCType,
565567
_: T.Type
@@ -571,8 +573,8 @@ public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable> (
571573

572574
/// Attempt to convert `x` from its Objective-C representation to its Swift
573575
/// representation.
574-
/// COMPILER_INTRINSIC
575-
@inlinable // FIXME(sil-serialize-all)
576+
// COMPILER_INTRINSIC
577+
@inlinable
576578
public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(
577579
_ x: T._ObjectiveCType,
578580
_: T.Type
@@ -692,7 +694,7 @@ func _makeSwiftValue(_ value: Any) -> AnyObject {
692694
/// that is `id`-compatible and dynamically castable back to the type of
693695
/// the boxed value, but is otherwise opaque.
694696
///
695-
/// COMPILER_INTRINSIC
697+
// COMPILER_INTRINSIC
696698
public func _bridgeAnythingToObjectiveC<T>(_ x: T) -> AnyObject {
697699
var done = false
698700
var result: AnyObject!

0 commit comments

Comments
 (0)