* Ignore -wmo when passing -dump-ast
* Cleanup on driver diagnostics
* Remove the FIXME.
* Add support for ignoring `-index-file`
* Revert unrelated formatting changes
* Revert back to only ignoring `-wmo`
Ignoring both `-wmo` and `-index-file` will be harder than just `-wmo`. This is because when calling the compiler and passing `-index-file` after `-dump-ast`, the option gets un-ignored by `Driver::buildOutputInfo`. Therefore, we will just ignore `-wmo` for now.
* Add tests, inspired by `Driver/batch_mode_with_WMO_or_index.swift`
When symbols are moved to this module, this module declares them as HIDE
for the OS versions prior to when the move happened. On the other hand, the
original module should declare ADD them for these OS versions. An executable
can choose the right library to link against depending on the deployment target.
This is a walk-around that linker directives cannot specify other install
name per symbol, we should eventually remove this.
Add various target-specific and compiler-determined paths to the output
of `-print-target-info`, such as the runtime resource path, SDK path, and
runtime library paths.
Rather than only emitting the target triple, provide additional
information about that particular target, including the module triple
(i.e., what file names will be used for Swift modules for that
triple), the runtime compatibility version if there is one, and
whether linking with rpaths is required for the standard library and
other libraries shipped with Swift. Encode this as JSON so we can
extend it in the future. For now, it looks like this:
```
{
"target": {
"triple": "arm64-apple-ios12.0",
"moduleTriple": "arm64-apple-ios",
"swiftRuntimeCompatibilityVersion": "5.0",
"librariesRequireRPath": true
}
}
```
Which you can deserialize into a TargetInfo instance as defined below:
```
struct Target: Codable {
/// The target triple.
var triple: String
/// The triple used for module file names.
var moduleTriple: String
/// If this platform provides the Swift runtime, the Swift language
version
/// with which that runtime is compatible.
var swiftRuntimeCompatibilityVersion: String?
/// Whether linking against the Swift libraries requires the use of
rpaths.
var librariesRequireRPath: Bool
}
struct TargetInfo: Codable {
var target: Target
}
```
Implements rdar://problem/47095159.
Add a -print-target-triple command line option to the Swift frontend
and driver to allow other tools (e.g., SwiftPM) to query the host
triple as it is understood by the Swift compiler. This follows the
precedent set by Clang. Implements rdar://problem/57434967.
This is a first version of cross module optimization (CMO).
The basic idea for CMO is to use the existing library evolution compiler features, but in an automated way. A new SIL module pass "annotates" functions and types with @inlinable and @usableFromInline. This results in functions being serialized into the swiftmodule file and thus available for optimizations in client modules.
The annotation is done with a worklist-algorithm, starting from public functions and continuing with entities which are used from already selected functions. A heuristic performs a preselection on which functions to consider - currently just generic functions are selected.
The serializer then writes annotated functions (including function bodies) into the swiftmodule file of the compiled module. Client modules are able to de-serialize such functions from their imported modules and use them for optimiations, like generic specialization.
The optimization is gated by a new compiler option -cross-module-optimization (also available in the swift driver).
By default this option is off. Without turning the option on, this change is (almost) a NFC.
rdar://problem/22591518
Frontend outputs source-as-compiled, and source-ranges file with function body ranges and ranges that were unparsed in secondaries.
Driver computes diffs for each source file. If diffs are in function bodies, only recompiles that one file. Else if diffs are in what another file did not parse, then the other file need not be rebuilt.
✔ More informative error messages in case of crashes.
✔ Handling and documenting different cases.
✔ Test cases for different cases.
✔ Make SDKDependencies.swift pass again.
...a situation we get into with indexing. The way Xcode generates
indexing invocations is to take a build command and add additional
flags to it; in order for the Driver to produce a single frontend
command from /that/, it currently plans as if it's going to do a
whole-module -typecheck and then turns around and uses -primary-file
anyway. This is questionable practice, to be sure...
...but meanwhile, let's not crash by trying to access declarations
that haven't been type-checked yet.
rdar://problem/53117124
Instead of SILGen'ing all primary files before we go on to optimize
and IRGen them, run each file to completion before starting the next
one. This reduces memory usage.