Skip to content

Commit a6952de

Browse files
[stdlib] Remove inlineable annotation from transparent functions (#17800)
* Remove inlineable annotation from transparent functions
1 parent 536ca5c commit a6952de

35 files changed

+1350
-1668
lines changed

stdlib/public/core/Assert.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
/// - line: The line number to print along with `message` if the assertion
3838
/// fails. The default is the line number where `assert(_:_:file:line:)`
3939
/// is called.
40-
@inlinable // FIXME(sil-serialize-all)
4140
@_transparent
4241
public func assert(
4342
_ condition: @autoclosure () -> Bool,
@@ -80,7 +79,6 @@ public func assert(
8079
/// - line: The line number to print along with `message` if the assertion
8180
/// fails. The default is the line number where
8281
/// `precondition(_:_:file:line:)` is called.
83-
@inlinable // FIXME(sil-serialize-all)
8482
@_transparent
8583
public func precondition(
8684
_ condition: @autoclosure () -> Bool,
@@ -163,7 +161,6 @@ public func assertionFailure(
163161
/// where `preconditionFailure(_:file:line:)` is called.
164162
/// - line: The line number to print along with `message`. The default is the
165163
/// line number where `preconditionFailure(_:file:line:)` is called.
166-
@inlinable // FIXME(sil-serialize-all)
167164
@_transparent
168165
public func preconditionFailure(
169166
_ message: @autoclosure () -> String = String(),
@@ -187,7 +184,6 @@ public func preconditionFailure(
187184
/// where `fatalError(_:file:line:)` is called.
188185
/// - line: The line number to print along with `message`. The default is the
189186
/// line number where `fatalError(_:file:line:)` is called.
190-
@inlinable // FIXME(sil-serialize-all)
191187
@_transparent
192188
public func fatalError(
193189
_ message: @autoclosure () -> String = String(),
@@ -203,7 +199,6 @@ public func fatalError(
203199
/// building in fast mode they are disabled. In release mode they don't print
204200
/// an error message but just trap. In debug mode they print an error message
205201
/// and abort.
206-
@inlinable // FIXME(sil-serialize-all)
207202
@_transparent
208203
public func _precondition(
209204
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
@@ -221,7 +216,6 @@ public func _precondition(
221216
}
222217
}
223218

224-
@inlinable // FIXME(sil-serialize-all)
225219
@_transparent
226220
public func _preconditionFailure(
227221
_ message: StaticString = StaticString(),
@@ -234,7 +228,6 @@ public func _preconditionFailure(
234228
/// If `error` is true, prints an error message in debug mode, traps in release
235229
/// mode, and returns an undefined error otherwise.
236230
/// Otherwise returns `result`.
237-
@inlinable // FIXME(sil-serialize-all)
238231
@_transparent
239232
public func _overflowChecked<T>(
240233
_ args: (T, Bool),
@@ -260,7 +253,6 @@ public func _overflowChecked<T>(
260253
/// and abort.
261254
/// They are meant to be used when the check is not comprehensively checking for
262255
/// all possible errors.
263-
@inlinable // FIXME(sil-serialize-all)
264256
@_transparent
265257
public func _debugPrecondition(
266258
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
@@ -275,7 +267,6 @@ public func _debugPrecondition(
275267
}
276268
}
277269

278-
@inlinable // FIXME(sil-serialize-all)
279270
@_transparent
280271
public func _debugPreconditionFailure(
281272
_ message: StaticString = StaticString(),
@@ -293,7 +284,6 @@ public func _debugPreconditionFailure(
293284
/// standard library. They are only enable when the standard library is built
294285
/// with the build configuration INTERNAL_CHECKS_ENABLED enabled. Otherwise, the
295286
/// call to this function is a noop.
296-
@inlinable // FIXME(sil-serialize-all)
297287
@_transparent
298288
public func _sanityCheck(
299289
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
@@ -307,7 +297,6 @@ public func _sanityCheck(
307297
#endif
308298
}
309299

310-
@inlinable // FIXME(sil-serialize-all)
311300
@_transparent
312301
public func _sanityCheckFailure(
313302
_ message: StaticString = StaticString(),

stdlib/public/core/AssertCommon.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ func _isDebugAssertConfiguration() -> Bool {
3030
return Int32(Builtin.assert_configuration()) == 0
3131
}
3232

33-
@inlinable // FIXME(sil-serialize-all)
34-
@_transparent
33+
@usableFromInline @_transparent
3534
internal func _isReleaseAssertConfiguration() -> Bool {
3635
// The values for the assert_configuration call are:
3736
// 0: Debug

stdlib/public/core/Bool.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public struct Bool {
6969
///
7070
/// Do not call this initializer directly. Instead, use the Boolean literal
7171
/// `false` to create a new `Bool` instance.
72-
@inlinable // FIXME(sil-serialize-all)
7372
@_transparent
7473
public init() {
7574
let zero: Int8 = 0
@@ -137,7 +136,6 @@ public struct Bool {
137136
}
138137

139138
extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLiteral {
140-
@inlinable // FIXME(sil-serialize-all)
141139
@_transparent
142140
public init(_builtinBooleanLiteral value: Builtin.Int1) {
143141
self._value = value
@@ -161,7 +159,6 @@ extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLitera
161159
/// this Boolean literal initializer behind the scenes.
162160
///
163161
/// - Parameter value: The value of the new instance.
164-
@inlinable // FIXME(sil-serialize-all)
165162
@_transparent
166163
public init(booleanLiteral value: Bool) {
167164
self = value
@@ -170,7 +167,6 @@ extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLitera
170167

171168
extension Bool {
172169
// This is a magic entry point known to the compiler.
173-
@inlinable // FIXME(sil-serialize-all)
174170
@_transparent
175171
public // COMPILER_INTRINSIC
176172
func _getBuiltinLogicValue() -> Builtin.Int1 {
@@ -187,13 +183,11 @@ extension Bool : CustomStringConvertible {
187183
}
188184

189185
// This is a magic entry point known to the compiler.
190-
@inlinable // FIXME(sil-serialize-all)
191186
@_transparent
192187
public // COMPILER_INTRINSIC
193188
func _getBool(_ v: Builtin.Int1) -> Bool { return Bool(v) }
194189

195190
extension Bool: Equatable {
196-
@inlinable // FIXME(sil-serialize-all)
197191
@_transparent
198192
public static func == (lhs: Bool, rhs: Bool) -> Bool {
199193
return Bool(Builtin.cmp_eq_Int1(lhs._value, rhs._value))
@@ -251,7 +245,6 @@ extension Bool {
251245
/// // Prints "You look nice today!"
252246
///
253247
/// - Parameter a: The Boolean value to negate.
254-
@inlinable // FIXME(sil-serialize-all)
255248
@_transparent
256249
public static prefix func ! (a: Bool) -> Bool {
257250
return Bool(Builtin.xor_Int1(a._value, true._value))

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
373373

374374
public let _rawValue: Builtin.RawPointer
375375

376-
@inlinable // FIXME(sil-serialize-all)
377376
@_transparent
378377
public // COMPILER_INTRINSIC
379378
init(_ _rawValue: Builtin.RawPointer) {
@@ -440,7 +439,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
440439
///
441440
/// - Warning: Accessing `pointee` as a type that is unrelated to
442441
/// the underlying memory's bound type is undefined.
443-
@inlinable // FIXME(sil-serialize-all)
444442
@_transparent
445443
public init<U>(_ from: UnsafeMutablePointer<U>) {
446444
self._rawValue = from._rawValue
@@ -456,7 +454,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
456454
///
457455
/// - Warning: Accessing `pointee` as a type that is unrelated to
458456
/// the underlying memory's bound type is undefined.
459-
@inlinable // FIXME(sil-serialize-all)
460457
@_transparent
461458
public init?<U>(_ from: UnsafeMutablePointer<U>?) {
462459
guard let unwrapped = from else { return nil }
@@ -494,7 +491,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
494491
}
495492

496493
extension AutoreleasingUnsafeMutablePointer: Equatable {
497-
@inlinable // FIXME(sil-serialize-all)
498494
@_transparent
499495
public static func == (
500496
lhs: AutoreleasingUnsafeMutablePointer,
@@ -509,7 +505,6 @@ extension UnsafeMutableRawPointer {
509505
/// instance.
510506
///
511507
/// - Parameter other: The pointer to convert.
512-
@inlinable // FIXME(sil-serialize-all)
513508
@_transparent
514509
public init<T>(_ other: AutoreleasingUnsafeMutablePointer<T>) {
515510
_rawValue = other._rawValue
@@ -520,7 +515,6 @@ extension UnsafeMutableRawPointer {
520515
///
521516
/// - Parameter other: The pointer to convert. If `other` is `nil`, the
522517
/// result is `nil`.
523-
@inlinable // FIXME(sil-serialize-all)
524518
@_transparent
525519
public init?<T>(_ other: AutoreleasingUnsafeMutablePointer<T>?) {
526520
guard let unwrapped = other else { return nil }
@@ -533,7 +527,6 @@ extension UnsafeRawPointer {
533527
/// instance.
534528
///
535529
/// - Parameter other: The pointer to convert.
536-
@inlinable // FIXME(sil-serialize-all)
537530
@_transparent
538531
public init<T>(_ other: AutoreleasingUnsafeMutablePointer<T>) {
539532
_rawValue = other._rawValue
@@ -544,7 +537,6 @@ extension UnsafeRawPointer {
544537
///
545538
/// - Parameter other: The pointer to convert. If `other` is `nil`, the
546539
/// result is `nil`.
547-
@inlinable // FIXME(sil-serialize-all)
548540
@_transparent
549541
public init?<T>(_ other: AutoreleasingUnsafeMutablePointer<T>?) {
550542
guard let unwrapped = other else { return nil }
@@ -631,7 +623,6 @@ internal struct _CocoaFastEnumerationStackBuf {
631623
///
632624
/// This is used by the Foundation overlays. The compiler will error if the
633625
/// passed-in type is generic or not representable in Objective-C
634-
@inlinable // FIXME(sil-serialize-all)
635626
@_transparent
636627
public func _getObjCTypeEncoding<T>(_ type: T.Type) -> UnsafePointer<Int8> {
637628
// This must be `@_transparent` because `Builtin.getObjCTypeEncoding` is

stdlib/public/core/Builtin.swift

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,38 +100,33 @@ public func _identityCast<T, U>(_ x: T, to expectedType: U.Type) -> U {
100100
}
101101

102102
/// `unsafeBitCast` something to `AnyObject`.
103-
@inlinable // FIXME(sil-serialize-all)
104-
@_transparent
103+
@usableFromInline @_transparent
105104
internal func _reinterpretCastToAnyObject<T>(_ x: T) -> AnyObject {
106105
return unsafeBitCast(x, to: AnyObject.self)
107106
}
108107

109-
@inlinable
110-
@_transparent
108+
@usableFromInline @_transparent
111109
internal func == (
112110
lhs: Builtin.NativeObject, rhs: Builtin.NativeObject
113111
) -> Bool {
114112
return unsafeBitCast(lhs, to: Int.self) == unsafeBitCast(rhs, to: Int.self)
115113
}
116114

117-
@inlinable
118-
@_transparent
115+
@usableFromInline @_transparent
119116
internal func != (
120117
lhs: Builtin.NativeObject, rhs: Builtin.NativeObject
121118
) -> Bool {
122119
return !(lhs == rhs)
123120
}
124121

125-
@inlinable
126-
@_transparent
122+
@usableFromInline @_transparent
127123
internal func == (
128124
lhs: Builtin.RawPointer, rhs: Builtin.RawPointer
129125
) -> Bool {
130126
return unsafeBitCast(lhs, to: Int.self) == unsafeBitCast(rhs, to: Int.self)
131127
}
132128

133-
@inlinable
134-
@_transparent
129+
@usableFromInline @_transparent
135130
internal func != (lhs: Builtin.RawPointer, rhs: Builtin.RawPointer) -> Bool {
136131
return !(lhs == rhs)
137132
}
@@ -169,8 +164,7 @@ public func != (t0: Any.Type?, t1: Any.Type?) -> Bool {
169164
/// Tell the optimizer that this code is unreachable if condition is
170165
/// known at compile-time to be true. If condition is false, or true
171166
/// but not a compile-time constant, this call has no effect.
172-
@inlinable // FIXME(sil-serialize-all)
173-
@_transparent
167+
@usableFromInline @_transparent
174168
internal func _unreachable(_ condition: Bool = true) {
175169
if condition {
176170
// FIXME: use a parameterized version of Builtin.unreachable when
@@ -181,8 +175,7 @@ internal func _unreachable(_ condition: Bool = true) {
181175

182176
/// Tell the optimizer that this code is unreachable if this builtin is
183177
/// reachable after constant folding build configuration builtins.
184-
@inlinable // FIXME(sil-serialize-all)
185-
@_transparent
178+
@usableFromInline @_transparent
186179
internal func _conditionallyUnreachable() -> Never {
187180
Builtin.conditionallyUnreachable()
188181
}
@@ -659,15 +652,13 @@ func _getSuperclass(_ t: Any.Type) -> AnyClass? {
659652
// and type checking will fail.
660653

661654
/// Returns `true` if `object` is uniquely referenced.
662-
@inlinable // FIXME(sil-serialize-all)
663-
@_transparent
655+
@usableFromInline @_transparent
664656
internal func _isUnique<T>(_ object: inout T) -> Bool {
665657
return Bool(Builtin.isUnique(&object))
666658
}
667659

668660
/// Returns `true` if `object` is uniquely referenced or pinned.
669-
@inlinable // FIXME(sil-serialize-all)
670-
@_transparent
661+
@usableFromInline @_transparent
671662
internal func _isUniqueOrPinned<T>(_ object: inout T) -> Bool {
672663
return Bool(Builtin.isUniqueOrPinned(&object))
673664
}

stdlib/public/core/BuiltinMath.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def TypedUnaryIntrinsicFunctions():
6464
% if bits == 80:
6565
#if !os(Windows) && (arch(i386) || arch(x86_64))
6666
% end
67-
@inlinable // FIXME(sil-serialize-all)
6867
@_transparent
6968
public func _${ufunc}(_ x: ${T}) -> ${T} {
7069
return ${T}(Builtin.int_${ufunc}_FPIEEE${bits}(x._value))

stdlib/public/core/CTypes.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,20 @@ public struct OpaquePointer {
116116
}
117117

118118
/// Creates an `OpaquePointer` from a given address in memory.
119-
@inlinable // FIXME(sil-serialize-all)
120119
@_transparent
121120
public init?(bitPattern: Int) {
122121
if bitPattern == 0 { return nil }
123122
self._rawValue = Builtin.inttoptr_Word(bitPattern._builtinWordValue)
124123
}
125124

126125
/// Creates an `OpaquePointer` from a given address in memory.
127-
@inlinable // FIXME(sil-serialize-all)
128126
@_transparent
129127
public init?(bitPattern: UInt) {
130128
if bitPattern == 0 { return nil }
131129
self._rawValue = Builtin.inttoptr_Word(bitPattern._builtinWordValue)
132130
}
133131

134132
/// Converts a typed `UnsafePointer` to an opaque C pointer.
135-
@inlinable // FIXME(sil-serialize-all)
136133
@_transparent
137134
public init<T>(_ from: UnsafePointer<T>) {
138135
self._rawValue = from._rawValue
@@ -141,15 +138,13 @@ public struct OpaquePointer {
141138
/// Converts a typed `UnsafePointer` to an opaque C pointer.
142139
///
143140
/// The result is `nil` if `from` is `nil`.
144-
@inlinable // FIXME(sil-serialize-all)
145141
@_transparent
146142
public init?<T>(_ from: UnsafePointer<T>?) {
147143
guard let unwrapped = from else { return nil }
148144
self.init(unwrapped)
149145
}
150146

151147
/// Converts a typed `UnsafeMutablePointer` to an opaque C pointer.
152-
@inlinable // FIXME(sil-serialize-all)
153148
@_transparent
154149
public init<T>(_ from: UnsafeMutablePointer<T>) {
155150
self._rawValue = from._rawValue
@@ -158,7 +153,6 @@ public struct OpaquePointer {
158153
/// Converts a typed `UnsafeMutablePointer` to an opaque C pointer.
159154
///
160155
/// The result is `nil` if `from` is `nil`.
161-
@inlinable // FIXME(sil-serialize-all)
162156
@_transparent
163157
public init?<T>(_ from: UnsafeMutablePointer<T>?) {
164158
guard let unwrapped = from else { return nil }

stdlib/public/core/ClosedRange.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ extension Comparable {
330330
/// - Parameters:
331331
/// - minimum: The lower bound for the range.
332332
/// - maximum: The upper bound for the range.
333-
@inlinable // trivial-implementation
334333
@_transparent
335334
public static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self> {
336335
_precondition(
@@ -362,7 +361,6 @@ extension Strideable where Stride: SignedInteger {
362361
/// - Parameters:)`.
363362
/// - minimum: The lower bound for the range.
364363
/// - maximum: The upper bound for the range.
365-
@inlinable // trivial-implementation
366364
@_transparent
367365
public static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self> {
368366
// FIXME: swift-3-indexing-model: tests for traps.

stdlib/public/core/CompilerProtocols.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ public protocol ExpressibleByExtendedGraphemeClusterLiteral
448448
extension ExpressibleByExtendedGraphemeClusterLiteral
449449
where ExtendedGraphemeClusterLiteralType == UnicodeScalarLiteralType {
450450

451-
@inlinable // FIXME(sil-serialize-all)
452451
@_transparent
453452
public init(unicodeScalarLiteral value: ExtendedGraphemeClusterLiteralType) {
454453
self.init(extendedGraphemeClusterLiteral: value)
@@ -514,7 +513,6 @@ public protocol ExpressibleByStringLiteral
514513
extension ExpressibleByStringLiteral
515514
where StringLiteralType == ExtendedGraphemeClusterLiteralType {
516515

517-
@inlinable // FIXME(sil-serialize-all)
518516
@_transparent
519517
public init(extendedGraphemeClusterLiteral value: StringLiteralType) {
520518
self.init(stringLiteral: value)

0 commit comments

Comments
 (0)