Skip to content

[stdlib] Move unused functions to LegacyABI.swift #75462

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 27, 2024
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
20 changes: 0 additions & 20 deletions stdlib/public/core/IntegerTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -761,26 +761,6 @@ extension Int {
}
}

@_transparent
@inlinable
internal func _unsafePlus(_ lhs: Int, _ rhs: Int) -> Int {
#if INTERNAL_CHECKS_ENABLED
return lhs + rhs
#else
return lhs &+ rhs
#endif
}

@_transparent
@inlinable
internal func _unsafeMinus(_ lhs: Int, _ rhs: Int) -> Int {
#if INTERNAL_CHECKS_ENABLED
return lhs - rhs
#else
return lhs &- rhs
#endif
}

@_unavailableInEmbedded
internal struct _IntegerAnyHashableBox<
Base: FixedWidthInteger
Expand Down
28 changes: 27 additions & 1 deletion stdlib/public/core/LegacyABI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -87,3 +87,29 @@ extension String.UTF16View {
@inlinable @inline(__always)
internal var _shortHeuristic: Int { return 32 }
}

@usableFromInline
internal func unimplemented_utf8_32bit(
_ message: String = "",
file: StaticString = #file, line: UInt = #line
) -> Never {
fatalError("32-bit: Unimplemented for UTF-8 support", file: file, line: line)
}

@usableFromInline
internal func _unsafePlus(_ lhs: Int, _ rhs: Int) -> Int {
#if INTERNAL_CHECKS_ENABLED
return lhs + rhs
#else
return lhs &+ rhs
#endif
}

@usableFromInline
internal func _unsafeMinus(_ lhs: Int, _ rhs: Int) -> Int {
#if INTERNAL_CHECKS_ENABLED
return lhs - rhs
#else
return lhs &- rhs
#endif
}
10 changes: 1 addition & 9 deletions stdlib/public/core/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand All @@ -12,14 +12,6 @@

import SwiftShims

@inlinable @_transparent
internal func unimplemented_utf8_32bit(
_ message: String = "",
file: StaticString = #file, line: UInt = #line
) -> Never {
fatalError("32-bit: Unimplemented for UTF-8 support", file: file, line: line)
}

/// A Unicode string value that is a collection of characters.
///
/// A string is a series of characters, such as `"Swift"`, that forms a
Expand Down