- Add SPI availability information to `APIAvailability` from attribute
`@_spi_available`.
- Correctly obtain effective availability for nested declarations
without immediate availability attributes.
Resolves rdar://159702280
<!--
If this pull request is targeting a release branch, please fill out the
following form:
https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1
Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:
Resolves <link to issue>, resolves <link to another issue>.
For more information about linking a pull request to an issue, see:
https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:
https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci
Thank you for your contribution to Swift!
-->
Correctly account for access scopes of declarations visited by APIGen:
Mark declarations with non-public access scopes as private SPIs.
Resolves rdar://159701853
When Swift visits an `ExtensionDecl` from an `@objc @implementation`
extension, it fetches the implemented Objective-C interface declaration
from the header file and adds to the visitor.
We don't want these API records from `APIGenRecorder` for Swift API
descriptor, because we cannot correctly reason about their API access as
they depend on the header group which Swift doesn't know about.
Resolves rdar://148943382
<!--
If this pull request is targeting a release branch, please fill out the
following form:
https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1
Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:
Resolves <link to issue>, resolves <link to another issue>.
For more information about linking a pull request to an issue, see:
https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:
https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci
Thank you for your contribution to Swift!
-->
Now that API descriptions are emitted during module build jobs when
`-emit-api-descriptor-path` is specified and the build system has been updated
to pass that flag when the output is needed, the `swift-api-extract` frontend
alias is no longer used. Delete it and the tests that were specific to invoking
`swift-api-extract`.
Resolves rdar://116537394.
This now specifies a category name that’s used in TBDGen, IRGen, and PrintAsClang. There are also now category name conflict diagnostics; these subsume some @implementation diagnostics.
(It turns out there was already a check for @objc(CustomName) to make sure it wasn’t a selector!)
api generation
This resolves the bug where apijson files recorded declarations as
unavailable purely because it was unavailable on a unrelated platforms.
Resolves: rdar://113552185
Instead, use the `%validate-json` lit substitution to validate and format the
API descriptor file before running it through FileCheck. This allows us to
avoid needing to introduce a dedicated frontend option just to control whether
the output of -emit-api-descriptor is pretty printed.
Make the changes to APIGenRecorder that are necessary to make it capable of
emitting API descriptors during -emit-module jobs. The output in this mode
differs from the output when run on an existing module in a couple of important
ways:
- The value for the `file` key in the descriptor JSON is now the path to the
source file that defines the declaration responsible for the symbol. In
`swift-api-extract` mode, the value for this key is the path to the module or
swiftinterface which is unavailable during an -emit-module job since the module
is usually not being emitted to its final installed location.
- Some additional symbols may be included in the API descriptor JSON because
more of the AST is available when emitting the module.
Resolves rdar://110916764
By plumbing the currently visited Decl through to APIRecorder we can improve
the correctness of API symbol visibility and availability in swift-api-extract
output.
By adopting this new utility, swift-api-extract more reliably gets the
ValueDecl associated with a symbol and therefore reports more accurate
availability info.
TBD files contain a section reserved for obj-c classes. Previously,
TBDGen was adding symbols with this + normal globals with objc class
prefixes. This patch removes the extra globals being added.
This also accounts for this behavior for `validate-tbd-against-ir`
checking.
Resolves: rdar://101442087
Emit Objective-C Categories for extensions that have the @objc attribute
directly (or indirectly via one of its methods, subscripts, etc) attached.
Also associate and emit all methods for that category into the API JSON file.
This fixes rdar://94734748.
The APIJSON tests used the default module cache and generated different
modules under the same name. This lead some tests to load a different
module than intended. This was made more easily detectable with the lock
on the swiftmodules instead of the swiftinterfaces.
Add a new swift-frontend driver option that extract APIs in the swift
module and print in JSON format. This is to allow tooling to understand
and process swift APIs without the need to be a swift compiler or
understand swift module/AST.