Skip to content

[stdlib] Remove inlineable annotation from transparent functions #17800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions stdlib/public/core/Assert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
/// - line: The line number to print along with `message` if the assertion
/// fails. The default is the line number where `assert(_:_:file:line:)`
/// is called.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func assert(
_ condition: @autoclosure () -> Bool,
Expand Down Expand Up @@ -80,7 +79,6 @@ public func assert(
/// - line: The line number to print along with `message` if the assertion
/// fails. The default is the line number where
/// `precondition(_:_:file:line:)` is called.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func precondition(
_ condition: @autoclosure () -> Bool,
Expand Down Expand Up @@ -163,7 +161,6 @@ public func assertionFailure(
/// where `preconditionFailure(_:file:line:)` is called.
/// - line: The line number to print along with `message`. The default is the
/// line number where `preconditionFailure(_:file:line:)` is called.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func preconditionFailure(
_ message: @autoclosure () -> String = String(),
Expand All @@ -187,7 +184,6 @@ public func preconditionFailure(
/// where `fatalError(_:file:line:)` is called.
/// - line: The line number to print along with `message`. The default is the
/// line number where `fatalError(_:file:line:)` is called.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func fatalError(
_ message: @autoclosure () -> String = String(),
Expand All @@ -203,7 +199,6 @@ public func fatalError(
/// building in fast mode they are disabled. In release mode they don't print
/// an error message but just trap. In debug mode they print an error message
/// and abort.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _precondition(
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
Expand All @@ -221,7 +216,6 @@ public func _precondition(
}
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _preconditionFailure(
_ message: StaticString = StaticString(),
Expand All @@ -234,7 +228,6 @@ public func _preconditionFailure(
/// If `error` is true, prints an error message in debug mode, traps in release
/// mode, and returns an undefined error otherwise.
/// Otherwise returns `result`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _overflowChecked<T>(
_ args: (T, Bool),
Expand All @@ -260,7 +253,6 @@ public func _overflowChecked<T>(
/// and abort.
/// They are meant to be used when the check is not comprehensively checking for
/// all possible errors.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _debugPrecondition(
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
Expand All @@ -275,7 +267,6 @@ public func _debugPrecondition(
}
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _debugPreconditionFailure(
_ message: StaticString = StaticString(),
Expand All @@ -293,7 +284,6 @@ public func _debugPreconditionFailure(
/// standard library. They are only enable when the standard library is built
/// with the build configuration INTERNAL_CHECKS_ENABLED enabled. Otherwise, the
/// call to this function is a noop.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _sanityCheck(
_ condition: @autoclosure () -> Bool, _ message: StaticString = StaticString(),
Expand All @@ -307,7 +297,6 @@ public func _sanityCheck(
#endif
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _sanityCheckFailure(
_ message: StaticString = StaticString(),
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/AssertCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func _isDebugAssertConfiguration() -> Bool {
return Int32(Builtin.assert_configuration()) == 0
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal func _isReleaseAssertConfiguration() -> Bool {
// The values for the assert_configuration call are:
// 0: Debug
Expand Down
7 changes: 0 additions & 7 deletions stdlib/public/core/Bool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public struct Bool {
///
/// Do not call this initializer directly. Instead, use the Boolean literal
/// `false` to create a new `Bool` instance.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init() {
let zero: Int8 = 0
Expand Down Expand Up @@ -137,7 +136,6 @@ public struct Bool {
}

extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLiteral {
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init(_builtinBooleanLiteral value: Builtin.Int1) {
self._value = value
Expand All @@ -161,7 +159,6 @@ extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLitera
/// this Boolean literal initializer behind the scenes.
///
/// - Parameter value: The value of the new instance.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init(booleanLiteral value: Bool) {
self = value
Expand All @@ -170,7 +167,6 @@ extension Bool : _ExpressibleByBuiltinBooleanLiteral, ExpressibleByBooleanLitera

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

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

extension Bool: Equatable {
@inlinable // FIXME(sil-serialize-all)
@_transparent
public static func == (lhs: Bool, rhs: Bool) -> Bool {
return Bool(Builtin.cmp_eq_Int1(lhs._value, rhs._value))
Expand Down Expand Up @@ -251,7 +245,6 @@ extension Bool {
/// // Prints "You look nice today!"
///
/// - Parameter a: The Boolean value to negate.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public static prefix func ! (a: Bool) -> Bool {
return Bool(Builtin.xor_Int1(a._value, true._value))
Expand Down
9 changes: 0 additions & 9 deletions stdlib/public/core/BridgeObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>

public let _rawValue: Builtin.RawPointer

@inlinable // FIXME(sil-serialize-all)
@_transparent
public // COMPILER_INTRINSIC
init(_ _rawValue: Builtin.RawPointer) {
Expand Down Expand Up @@ -440,7 +439,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
///
/// - Warning: Accessing `pointee` as a type that is unrelated to
/// the underlying memory's bound type is undefined.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init<U>(_ from: UnsafeMutablePointer<U>) {
self._rawValue = from._rawValue
Expand All @@ -456,7 +454,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
///
/// - Warning: Accessing `pointee` as a type that is unrelated to
/// the underlying memory's bound type is undefined.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init?<U>(_ from: UnsafeMutablePointer<U>?) {
guard let unwrapped = from else { return nil }
Expand Down Expand Up @@ -494,7 +491,6 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
}

extension AutoreleasingUnsafeMutablePointer: Equatable {
@inlinable // FIXME(sil-serialize-all)
@_transparent
public static func == (
lhs: AutoreleasingUnsafeMutablePointer,
Expand All @@ -509,7 +505,6 @@ extension UnsafeMutableRawPointer {
/// instance.
///
/// - Parameter other: The pointer to convert.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init<T>(_ other: AutoreleasingUnsafeMutablePointer<T>) {
_rawValue = other._rawValue
Expand All @@ -520,7 +515,6 @@ extension UnsafeMutableRawPointer {
///
/// - Parameter other: The pointer to convert. If `other` is `nil`, the
/// result is `nil`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init?<T>(_ other: AutoreleasingUnsafeMutablePointer<T>?) {
guard let unwrapped = other else { return nil }
Expand All @@ -533,7 +527,6 @@ extension UnsafeRawPointer {
/// instance.
///
/// - Parameter other: The pointer to convert.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init<T>(_ other: AutoreleasingUnsafeMutablePointer<T>) {
_rawValue = other._rawValue
Expand All @@ -544,7 +537,6 @@ extension UnsafeRawPointer {
///
/// - Parameter other: The pointer to convert. If `other` is `nil`, the
/// result is `nil`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init?<T>(_ other: AutoreleasingUnsafeMutablePointer<T>?) {
guard let unwrapped = other else { return nil }
Expand Down Expand Up @@ -631,7 +623,6 @@ internal struct _CocoaFastEnumerationStackBuf {
///
/// This is used by the Foundation overlays. The compiler will error if the
/// passed-in type is generic or not representable in Objective-C
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _getObjCTypeEncoding<T>(_ type: T.Type) -> UnsafePointer<Int8> {
// This must be `@_transparent` because `Builtin.getObjCTypeEncoding` is
Expand Down
27 changes: 9 additions & 18 deletions stdlib/public/core/Builtin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,38 +100,33 @@ public func _identityCast<T, U>(_ x: T, to expectedType: U.Type) -> U {
}

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

@inlinable
@_transparent
@usableFromInline @_transparent
internal func == (
lhs: Builtin.NativeObject, rhs: Builtin.NativeObject
) -> Bool {
return unsafeBitCast(lhs, to: Int.self) == unsafeBitCast(rhs, to: Int.self)
}

@inlinable
@_transparent
@usableFromInline @_transparent
internal func != (
lhs: Builtin.NativeObject, rhs: Builtin.NativeObject
) -> Bool {
return !(lhs == rhs)
}

@inlinable
@_transparent
@usableFromInline @_transparent
internal func == (
lhs: Builtin.RawPointer, rhs: Builtin.RawPointer
) -> Bool {
return unsafeBitCast(lhs, to: Int.self) == unsafeBitCast(rhs, to: Int.self)
}

@inlinable
@_transparent
@usableFromInline @_transparent
internal func != (lhs: Builtin.RawPointer, rhs: Builtin.RawPointer) -> Bool {
return !(lhs == rhs)
}
Expand Down Expand Up @@ -169,8 +164,7 @@ public func != (t0: Any.Type?, t1: Any.Type?) -> Bool {
/// Tell the optimizer that this code is unreachable if condition is
/// known at compile-time to be true. If condition is false, or true
/// but not a compile-time constant, this call has no effect.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal func _unreachable(_ condition: Bool = true) {
if condition {
// FIXME: use a parameterized version of Builtin.unreachable when
Expand All @@ -181,8 +175,7 @@ internal func _unreachable(_ condition: Bool = true) {

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

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

/// Returns `true` if `object` is uniquely referenced or pinned.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal func _isUniqueOrPinned<T>(_ object: inout T) -> Bool {
return Bool(Builtin.isUniqueOrPinned(&object))
}
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/BuiltinMath.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def TypedUnaryIntrinsicFunctions():
% if bits == 80:
#if !os(Windows) && (arch(i386) || arch(x86_64))
% end
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _${ufunc}(_ x: ${T}) -> ${T} {
return ${T}(Builtin.int_${ufunc}_FPIEEE${bits}(x._value))
Expand Down
6 changes: 0 additions & 6 deletions stdlib/public/core/CTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,20 @@ public struct OpaquePointer {
}

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

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

/// Converts a typed `UnsafePointer` to an opaque C pointer.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init<T>(_ from: UnsafePointer<T>) {
self._rawValue = from._rawValue
Expand All @@ -141,15 +138,13 @@ public struct OpaquePointer {
/// Converts a typed `UnsafePointer` to an opaque C pointer.
///
/// The result is `nil` if `from` is `nil`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init?<T>(_ from: UnsafePointer<T>?) {
guard let unwrapped = from else { return nil }
self.init(unwrapped)
}

/// Converts a typed `UnsafeMutablePointer` to an opaque C pointer.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init<T>(_ from: UnsafeMutablePointer<T>) {
self._rawValue = from._rawValue
Expand All @@ -158,7 +153,6 @@ public struct OpaquePointer {
/// Converts a typed `UnsafeMutablePointer` to an opaque C pointer.
///
/// The result is `nil` if `from` is `nil`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public init?<T>(_ from: UnsafeMutablePointer<T>?) {
guard let unwrapped = from else { return nil }
Expand Down
2 changes: 0 additions & 2 deletions stdlib/public/core/ClosedRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ extension Comparable {
/// - Parameters:
/// - minimum: The lower bound for the range.
/// - maximum: The upper bound for the range.
@inlinable // trivial-implementation
@_transparent
public static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self> {
_precondition(
Expand Down Expand Up @@ -362,7 +361,6 @@ extension Strideable where Stride: SignedInteger {
/// - Parameters:)`.
/// - minimum: The lower bound for the range.
/// - maximum: The upper bound for the range.
@inlinable // trivial-implementation
@_transparent
public static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self> {
// FIXME: swift-3-indexing-model: tests for traps.
Expand Down
2 changes: 0 additions & 2 deletions stdlib/public/core/CompilerProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ public protocol ExpressibleByExtendedGraphemeClusterLiteral
extension ExpressibleByExtendedGraphemeClusterLiteral
where ExtendedGraphemeClusterLiteralType == UnicodeScalarLiteralType {

@inlinable // FIXME(sil-serialize-all)
@_transparent
public init(unicodeScalarLiteral value: ExtendedGraphemeClusterLiteralType) {
self.init(extendedGraphemeClusterLiteral: value)
Expand Down Expand Up @@ -514,7 +513,6 @@ public protocol ExpressibleByStringLiteral
extension ExpressibleByStringLiteral
where StringLiteralType == ExtendedGraphemeClusterLiteralType {

@inlinable // FIXME(sil-serialize-all)
@_transparent
public init(extendedGraphemeClusterLiteral value: StringLiteralType) {
self.init(stringLiteral: value)
Expand Down
Loading