Centralize part of the routine that selects which resources to free. Then, add an additional condition for -dump-api-path.
Before, if this option were specified along with -emit-llvm or -c, the compiler would try to rebuild the torn-down ModuleDecl and crash trying to access the torn-down ASTContext.
The lifetime of the UnifiedStatsReporter was not entirely clear from context. Stick it in the CompilerInstance instead so it can live as long as the compile job.
It is critical that its lifetime be extended beyond that of the ASTContext, as the context may be torn down by the time code generation happens, but additional statistics are recorded during LLVM codegen.
When a “separately imported overlay” is added to a SourceFile, two things happen:
1. The direct import of the underlying module is removed from getImports*() by default. It is only visible if the caller passes ImportFilterKind:: ShadowedBySeparateOverlay. This means that non-module-scoped lookups will search _OverlayModule before searching its re-export UnderlyingModule, allowing it to shadow underlying declarations.
2. When you ask for lookupInModule() to look in the underlying module in that source file, it looks in the overlays instead. This means that UnderlyingModule.foo() can find declarations in _OverlayModule.
Static-linked libraries could add symbols to the final tbd file. We need
this flag to specify additional module names to collect symbols from.
rdar://59399684
For more context, see:
1. https://github.com/apple/swift/pull/29239 - original PR which introduced
the change, including an LLDB-side change.
2. The immediately preceding commit, which reverted this change.
3. https://github.com/apple/swift/pull/29350 which revealed some breakage
caused by the changes in PR 29239 (unrelated to printing).
The REPL was using the CompilerInstance to stash this parameter, then it would immediately move it into IRGen. Drop the setter and pass this data directly.
Add an extra phase after all the argument parsing has completed that sets inter-option-dependent flags. This allows for the const-qualification of IRGenOptions, and removes some weird state flipping in FrontendTool.
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed. Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
Using the new linker directives $ld$previous requires the compiler to know the previous
install names for the symbols marked as removed. This patch teaches the compiler
to take a path to a Json file specifying the map between module names and previous
install names. Also, these install names can be platform-specific.
Progress towards: rdar://58281536
Restructure fine-grained-dependencies to enable unit testing
Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files
Use deterministic order for more information outputs.
Set EnableFineGrainedDependencies consistently in frontend.
Tolerate errors that result in null getExtendedNominal()
Fix memory issue by removing node everywhere.
Break up print routine
Be more verbose so it will compile on Linux.
Sort batchable jobs, too.
Rather than parsing all delayed bodies for
`-dump-parse` once we finish parsing, tell the
parser not to delay any bodies. This then allows
us to remove `DelayedDeclLists` from
PersistentParserState.
Restructure fine-grained-dependencies to enable unit testing
Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files
Use deterministic order for more information outputs.
Set EnableFineGrainedDependencies consistently in frontend.
Tolerate errors that result in null getExtendedNominal()
Fix memory issue by removing node everywhere.
Break up print routine
Be more verbose so it will compile on Linux.
Sort batchable jobs, too.
* 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.