@@ -1787,11 +1787,13 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
1787
1787
assert (ctx.getLoadedModules ().begin ()->second == Instance.getMainModule ());
1788
1788
}
1789
1789
1790
- // Verify the AST for all the modules we've loaded.
1791
- ctx.verifyAllLoadedModules ();
1790
+ if (!opts.AllowModuleWithCompilerErrors ) {
1791
+ // Verify the AST for all the modules we've loaded.
1792
+ ctx.verifyAllLoadedModules ();
1792
1793
1793
- // Verify generic signatures if we've been asked to.
1794
- verifyGenericSignaturesIfNeeded (Invocation, ctx);
1794
+ // Verify generic signatures if we've been asked to.
1795
+ verifyGenericSignaturesIfNeeded (Invocation, ctx);
1796
+ }
1795
1797
1796
1798
// Emit any additional outputs that we only need for a successful compilation.
1797
1799
// We don't want to unnecessarily delay getting any errors back to the user.
@@ -1913,7 +1915,8 @@ withSemanticAnalysis(CompilerInstance &Instance, FrontendObserver *observer,
1913
1915
1914
1916
(void )migrator::updateCodeAndEmitRemapIfNeeded (&Instance);
1915
1917
1916
- if (Instance.getASTContext ().hadError ())
1918
+ if (Instance.getASTContext ().hadError () &&
1919
+ !opts.AllowModuleWithCompilerErrors )
1917
1920
return true ;
1918
1921
1919
1922
return cont (Instance);
@@ -2096,7 +2099,8 @@ static bool performCompile(CompilerInstance &Instance,
2096
2099
if (Instance.hasASTContext () &&
2097
2100
FrontendOptions::doesActionPerformEndOfPipelineActions (Action)) {
2098
2101
performEndOfPipelineActions (Instance);
2099
- hadError |= Instance.getASTContext ().hadError ();
2102
+ if (!opts.AllowModuleWithCompilerErrors )
2103
+ hadError |= Instance.getASTContext ().hadError ();
2100
2104
}
2101
2105
return hadError;
2102
2106
}
@@ -2382,7 +2386,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
2382
2386
if (PSPs.haveModuleOrModuleDocOutputPaths ()) {
2383
2387
if (Action == FrontendOptions::ActionType::MergeModules ||
2384
2388
Action == FrontendOptions::ActionType::EmitModuleOnly) {
2385
- return Context.hadError ();
2389
+ return Context.hadError () && !opts. AllowModuleWithCompilerErrors ;
2386
2390
}
2387
2391
}
2388
2392
@@ -2400,7 +2404,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
2400
2404
2401
2405
// Check if we had any errors; if we did, don't proceed to IRGen.
2402
2406
if (Context.hadError ())
2403
- return true ;
2407
+ return !opts. AllowModuleWithCompilerErrors ;
2404
2408
2405
2409
runSILLoweringPasses (*SM);
2406
2410
0 commit comments