Skip to content

Commit 921180f

Browse files
committed
[NFC] Remove DelayWholeModuleChecking
While refactoring in 48805b1, I accidentally added the computation of this bit before CompilerInstance::setupInputs is called. This means that the compiler currently does not have any knowledge of any primary input buffers, and thus the check for whole module mode is trivially true. As a consequence, this bit has been true ever since. Since we seem to have got on just fine without computing this correctly, just inline that truthiness everywhere. Whoops
1 parent f8810ab commit 921180f

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,7 @@ namespace swift {
484484
/// 4.2 GHz Intel Core i7.
485485
/// (It's arbitrary, but will keep the compiler from taking too much time.)
486486
unsigned SwitchCheckingInvocationThreshold = 200000;
487-
488-
/// Whether to delay checking that benefits from having the entire
489-
/// module parsed, e.g., Objective-C method override checking.
490-
bool DelayWholeModuleChecking = false;
491-
487+
492488
/// If true, the time it takes to type-check each function will be dumped
493489
/// to llvm::errs().
494490
bool DebugTimeFunctionBodies = false;

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,24 +1451,6 @@ void TypeCheckSourceFileRequest::cacheResult(evaluator::SideEffect) const {
14511451
FrontendStatsTracer tracer(Ctx.Stats, "AST verification");
14521452
// Verify the SourceFile.
14531453
swift::verify(*SF);
1454-
1455-
// Verify imported modules.
1456-
//
1457-
// Skip per-file verification in whole-module mode. Verifying imports
1458-
// between files could cause the importer to cache declarations without
1459-
// adding them to the ASTContext. This happens when the importer registers a
1460-
// declaration without a valid TypeChecker instance, as is the case during
1461-
// verification. A subsequent file may require that declaration to be fully
1462-
// imported (e.g. to synthesized a function body), but since it has already
1463-
// been cached, it will never be added to the ASTContext. The solution is to
1464-
// skip verification and avoid caching it.
1465-
#ifndef NDEBUG
1466-
if (!Ctx.TypeCheckerOpts.DelayWholeModuleChecking &&
1467-
SF->Kind != SourceFileKind::SIL &&
1468-
!Ctx.LangOpts.DebuggerSupport) {
1469-
Ctx.verifyAllLoadedModules();
1470-
}
1471-
#endif
14721454
}
14731455
}
14741456

lib/Frontend/Frontend.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -883,11 +883,9 @@ void CompilerInstance::forEachFileToTypeCheck(
883883
}
884884

885885
void CompilerInstance::finishTypeChecking() {
886-
if (getASTContext().TypeCheckerOpts.DelayWholeModuleChecking) {
887-
forEachSourceFileIn(MainModule, [&](SourceFile &SF) {
888-
performWholeModuleTypeChecking(SF);
889-
});
890-
}
886+
forEachSourceFileIn(MainModule, [&](SourceFile &SF) {
887+
performWholeModuleTypeChecking(SF);
888+
});
891889
}
892890

893891
SourceFile *CompilerInstance::createSourceFileForMainModule(

lib/Sema/TypeChecker.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,6 @@ TypeCheckSourceFileRequest::evaluate(Evaluator &eval, SourceFile *SF) const {
357357
CheckInconsistentImplementationOnlyImportsRequest{SF->getParentModule()},
358358
{});
359359

360-
// Checking that benefits from having the whole module available.
361-
if (!Ctx.TypeCheckerOpts.DelayWholeModuleChecking) {
362-
performWholeModuleTypeChecking(*SF);
363-
}
364-
365360
// Perform various AST transforms we've been asked to perform.
366361
if (!Ctx.hadError() && Ctx.LangOpts.DebuggerTestingTransform)
367362
performDebuggerTestingTransform(*SF);

0 commit comments

Comments
 (0)