-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the Swift compilation APIs to use a style similar to the C++…
… APIs. `swift_common.compile` now returns a tuple with two elements, very similar to `cc_common.compile`: 1. A "module context" (the same kind of value returned by `swift_common.create_module` that has `clang` and `swift` fields) 2. A `CcCompilationOutputs` object containing the object files. The returned module context is slightly different than those propagated by the rules previously, in that its `clang` field will be present even if the Swift module doesn't propagate a Clang module. This is so that callers can easily retrieve its `compilation_context` and return it in a `CcInfo` provider. Therefore, callers who want to know whether a module context exposes a Clang module should check the `clang.module_map` field rather than just the `clang` field; it will be `None` if there is no Clang module. A new method, `swift_common.create_linking_context_from_compilation_outputs`, has also been added, which provides similar functionality to the `cc_common` method of the same name. This takes the module context and compilation outputs from the `compile` call and produces a `LinkingContext` that can be returned in a `CcInfo` provider. Of particular note, any toolchain-specific post-compile actions, such as module-wrapping or autolink extraction, have been moved into `create_linking_context_from_compilation_outputs`; they are no longer outputs of `compile`. This provides a clean API division between what is strictly compilation vs. the other supplemental outputs/flags that are passed to the linker, without making extra work to ensure that those outputs are generated. PiperOrigin-RevId: 380030635 (cherry picked from commit 0bbf2d3) Conflicts: swift/internal/compiling.bzl
- Loading branch information
Showing
12 changed files
with
588 additions
and
753 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.