Merge pull request #28515 from DougGregor/fast-dependency-scanning

Fast dependency scanning for Swift
This commit is contained in:
Doug Gregor
2020-04-24 23:54:06 -07:00
committed by GitHub
43 changed files with 2014 additions and 17 deletions

View File

@@ -687,11 +687,10 @@ std::unique_ptr<SILModule> CompilerInstance::takeSILModule() {
/// builds. This allows for use of popular specialized functions
/// from the standard library, which makes the non-optimized builds
/// execute much faster.
static bool shouldImplicityImportSwiftOnoneSupportModule(
const CompilerInvocation &Invocation) {
if (Invocation.getImplicitStdlibKind() != ImplicitStdlibKind::Stdlib)
bool CompilerInvocation::shouldImportSwiftONoneSupport() const {
if (getImplicitStdlibKind() != ImplicitStdlibKind::Stdlib)
return false;
if (Invocation.getSILOptions().shouldOptimize())
if (getSILOptions().shouldOptimize())
return false;
// If we are not executing an action that has a dependency on
@@ -706,7 +705,7 @@ static bool shouldImplicityImportSwiftOnoneSupportModule(
//
// This optimization is disabled by -track-system-dependencies to preserve
// the explicit dependency.
const auto &options = Invocation.getFrontendOptions();
const auto &options = getFrontendOptions();
return options.TrackSystemDeps
|| FrontendOptions::doesActionGenerateSIL(options.RequestedAction);
}
@@ -720,7 +719,7 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
for (auto &moduleStr : frontendOpts.getImplicitImportModuleNames())
imports.ModuleNames.push_back(Context->getIdentifier(moduleStr));
if (shouldImplicityImportSwiftOnoneSupportModule(Invocation))
if (Invocation.shouldImportSwiftONoneSupport())
imports.ModuleNames.push_back(Context->getIdentifier(SWIFT_ONONE_SUPPORT));
imports.ShouldImportUnderlyingModule = frontendOpts.ImportUnderlyingModule;