Skip to content

ABIChecker: obsoleted/unavailable ABI-public decls #33694

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

Closed
Closed
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
27 changes: 16 additions & 11 deletions stdlib/public/core/LegacyABI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,48 @@
//
// 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 - 2020 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
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

//
// This file contains non-API (or underscored) declarations that are needed to
// be kept around for ABI compatibility
//
//===----------------------------------------------------------------------===//

extension Unicode.UTF16 {
@available(*, unavailable, renamed: "Unicode.UTF16.isASCII")
@inlinable
public static func _isASCII(_ x: CodeUnit) -> Bool {
@usableFromInline
internal static func _isASCII(_ x: CodeUnit) -> Bool {
return Unicode.UTF16.isASCII(x)
}
}

@available(*, unavailable, renamed: "Unicode.UTF8.isASCII")
@inlinable
@usableFromInline
internal func _isASCII(_ x: UInt8) -> Bool {
return Unicode.UTF8.isASCII(x)
}

@available(*, unavailable, renamed: "Unicode.UTF8.isContinuation")
@inlinable
@usableFromInline
internal func _isContinuation(_ x: UInt8) -> Bool {
return UTF8.isContinuation(x)
}

extension Substring {
@available(*, unavailable, renamed: "Substring.base")
@inlinable
@available(*, unavailable, renamed: "Substring.base")
@usableFromInline
internal var _wholeString: String { return base }
}

extension String {
@available(*, unavailable, renamed: "String.withUTF8")
@inlinable
@usableFromInline
internal func _withUTF8<R>(
_ body: (UnsafeBufferPointer<UInt8>) throws -> R
) rethrows -> R {
Expand All @@ -52,7 +54,7 @@ extension String {

extension Substring {
@available(*, unavailable, renamed: "Substring.withUTF8")
@inlinable
@usableFromInline
internal func _withUTF8<R>(
_ body: (UnsafeBufferPointer<UInt8>) throws -> R
) rethrows -> R {
Expand All @@ -63,6 +65,7 @@ extension Substring {

// This function is no longer used but must be kept for ABI compatibility
// because references to it may have been inlined.
@available(*, unavailable)
@usableFromInline
internal func _branchHint(_ actual: Bool, expected: Bool) -> Bool {
// The LLVM intrinsic underlying int_expect_Int1 now requires an immediate
Expand All @@ -73,6 +76,7 @@ internal func _branchHint(_ actual: Bool, expected: Bool) -> Bool {
}

extension String {
@available(*, unavailable)
@usableFromInline // Never actually used in inlinable code...
internal func _nativeCopyUTF16CodeUnits(
into buffer: UnsafeMutableBufferPointer<UInt16>,
Expand All @@ -84,6 +88,7 @@ extension String.UTF16View {
// Swift 5.x: This was accidentally shipped as inlinable, but was never used
// from an inlinable context. The definition is kept around for techincal ABI
// compatibility (even though it shouldn't matter), but is unused.
@inlinable @inline(__always)
@available(*, unavailable)
@usableFromInline
internal var _shortHeuristic: Int { return 32 }
}
34 changes: 34 additions & 0 deletions test/api-digester/Outputs/cake-abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,22 @@
"ObjC"
],
"funcSelfKind": "NonMutating"
},
{
"kind": "Function",
"name": "functionUnavailableOnMac",
"printedName": "functionUnavailableOnMac()",
"children": [
{
"kind": "TypeNominal",
"name": "Void",
"printedName": "()"
}
],
"declKind": "Func",
"usr": "s:4cake14SwiftObjcClassC24functionUnavailableOnMacyyF",
"moduleName": "cake",
"funcSelfKind": "NonMutating"
}
],
"declKind": "Class",
Expand All @@ -1493,6 +1509,24 @@
],
"hasMissingDesignatedInitializers": true
},
{
"kind": "TypeDecl",
"name": "UnavailableOnMac",
"printedName": "UnavailableOnMac",
"declKind": "Class",
"usr": "s:4cake16UnavailableOnMacC",
"moduleName": "cake",
"intro_iOS": "10.2",
"intro_tvOS": "10.3",
"intro_watchOS": "3.4",
"declAttributes": [
"Available",
"Available",
"Available",
"Available"
],
"hasMissingDesignatedInitializers": true
},
{
"kind": "TypeDecl",
"name": "Int",
Expand Down
10 changes: 0 additions & 10 deletions test/api-digester/stability-stdlib-abi-with-asserts.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,3 @@
// The digester can incorrectly register a generic signature change when
// declarations are shuffled. rdar://problem/46618883
// UNSUPPORTED: swift_evolve

Func _collectReferencesInsideObject(_:) is a new API without @available attribute
Func _loadDestroyTLSCounter() is a new API without @available attribute
Func _measureRuntimeFunctionCountersDiffs(objects:_:) is a new API without @available attribute
Protocol _RuntimeFunctionCountersStats is a new API without @available attribute
Struct _GlobalRuntimeFunctionCountersState is a new API without @available attribute
Struct _ObjectRuntimeFunctionCountersState is a new API without @available attribute
Struct _RuntimeFunctionCounters is a new API without @available attribute
Func _swift_isImmutableCOWBuffer(_:) is a new API without @available attribute
Func _swift_setImmutableCOWBuffer(_:_:) is a new API without @available attribute
8 changes: 0 additions & 8 deletions test/api-digester/stability-stdlib-abi-without-asserts.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,3 @@
// The digester can incorrectly register a generic signature change when
// declarations are shuffled. rdar://problem/46618883
// UNSUPPORTED: swift_evolve

Func _prespecialize() is a new API without @available attribute
Func _stdlib_isOSVersionAtLeastOrVariantVersionAtLeast(_:_:_:_:_:_:) is a new API without @available attribute

// These reflection APIs are exposed to facilitate building SwiftReflectionTest.swift when testing Release builds.
Func _getMetadataSection(_:) is a new API without @available attribute
Func _getMetadataSectionCount() is a new API without @available attribute
Func _getMetadataSectionName(_:) is a new API without @available attribute
4 changes: 2 additions & 2 deletions tools/swift-api-digester/ModuleAnalyzerNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,9 +1611,9 @@ SDKContext::shouldIgnore(Decl *D, const Decl* Parent) const {
} else {
if (D->isPrivateStdlibDecl(false))
return true;
if (AvailableAttr::isUnavailable(D))
return true;
}
if (AvailableAttr::isUnavailable(D))
return true;
if (auto VD = dyn_cast<ValueDecl>(D)) {
switch (getAccessLevel(VD)) {
case AccessLevel::Internal:
Expand Down
Loading