-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Previous ID | SR-13351 |
Radar | rdar://problem/66609263 |
Original Reporter | @DougGregor |
Type | New Feature |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | New Feature |
Assignee | @artemcm |
Priority | Medium |
md5: fcb2a41238d40f996b3f5256e8c7b645
Issue Description:
The Swift driver provides support for parsable output (https://github.com/apple/swift/blob/master/docs/DriverParseableOutput.md), which is used by build systems to get information about the various sub-tasks that are executed by the Swift driver to build a module.
With the integrated Swift driver (e.g., in the Swift Package Manager with --use-integrated-swift-driver), the build system executes the various Swift frontend jobs directly (rather than them getting indirectly run through the driver), so parsable output is mostly unnecessary. However, the integrated Swift driver still uses batch mode for performance reasons, in which > 1 Swift source files are compiled by the same Swift frontend job. In these cases, the integrated Swift driver will report results only on a per-job basis, which is misleading: we instead want to report each individual Swift source file that is compiled, regardless of the batching strategy. Parsable output already has this notion via quasi-PIDs, but the Swift frontend doesn't understand how to generate parsable output.
We should implement support for the -parsable-output flag in the Swift frontend as well. We will likely need to give it a starting quasi-PID value (e.g., -10), such that each of the Swift source files in that batch will get distinct PID values (-10, -9, -8, etc.), which will be guaranteed to stay negative (so they don't look like real PIDs). The code for emitting parsable output currently lives in the C++ driver, but can be sunk down into the Swift frontend library so it can be shared among the two. Only the integrated Swift driver should care about this, so it would be the responsibility of the build system (e.g., SwiftPM) to add the -parsable-output to each of the jobs (or somehow indicate to the driver that it should do so).
Note that, once we have this, we can revert most of the change in swiftlang/swift-package-manager#2850 so that each frontend job will get its own "parser" and we'll get all of the expected updates.