-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Driver] -enable-batch-mode implies -continue-building-after-errors #16521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Driver] -enable-batch-mode implies -continue-building-after-errors #16521
Conversation
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor suggestions, but they seem worthwhile to me.
lib/Driver/Driver.cpp
Outdated
@@ -703,6 +703,17 @@ Driver::buildCompilation(const ToolChain &TC, | |||
OI.CompilerMode = computeCompilerMode(*TranslatedArgList, Inputs, BatchMode); | |||
buildOutputInfo(TC, *TranslatedArgList, BatchMode, Inputs, OI); | |||
|
|||
// Note: Batch mode handling of serialized diagnostics requires that all | |||
// batches get to run. (This behavior could be limited to only when serialized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be valuable to explain a bit more about why all batches get to run, either here, or somewhere else with a pointer to here. It would save someone a lot of head-scratching someday.
lib/Driver/Driver.cpp
Outdated
// to go on to compilation of source files, and if compilation of source files | ||
// fails, we shouldn't try to link. Instead, we'd want to let all jobs finish | ||
// but not schedule any new ones. | ||
ContinueBuildingAfterErrors |= BatchMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ContinueBuildingAfterErrors
isn't used before this, so how about moving the earlier code that reads the argument and sets it down to here? That way it could be a const bool
instead of just a bool
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, consider adding an assertion ContinueBuildingAfterErrors || !BatchMode
around line 531 in Compilation.cpp
where it says return Comp.ContinueBuildingAfterErrors ? ... : ...
The logic in 46b8ad3 to avoid putting certain diagnostics into serialized diagnostic files only makes sense if 1. every diagnostic emitted in file A.swift while processing a different file B.swift would be emitted if we processed A.swift on its own 2. we actually do process A.swift on its own in the same build, or have previously done an incremental build and produced the same diagnostic But the latter isn't actually guaranteed: if one batch job exits with a failure status, the driver will exit as well, assuming there's no point in continuing. Fortunately, we do have a flag that overrides this behavior, -continue-building-after-errors. (As noted in the patch, -continue-building-after-errors isn't *exactly* what we want. But it's conservatively correct.)
2b9c230
to
f9fd6a3
Compare
Updated! @swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…wiftlang#16521) The logic in 46b8ad3 to avoid putting certain diagnostics into serialized diagnostic files only makes sense if 1. every diagnostic emitted in file A.swift while processing a different file B.swift would be emitted if we processed A.swift on its own 2. we actually do process A.swift on its own in the same build, or have previously done an incremental build and produced the same diagnostic But the latter isn't actually guaranteed: if one batch job exits with a failure status, the driver will exit as well, assuming there's no point in continuing. Fortunately, we do have a flag that overrides this behavior, -continue-building-after-errors. (As noted in the patch, -continue-building-after-errors isn't *exactly* what we want. But it's conservatively correct.) (cherry picked from commit 606ee29)
…wiftlang#16521) The logic in 46b8ad3 to avoid putting certain diagnostics into serialized diagnostic files only makes sense if 1. every diagnostic emitted in file A.swift while processing a different file B.swift would be emitted if we processed A.swift on its own 2. we actually do process A.swift on its own in the same build, or have previously done an incremental build and produced the same diagnostic But the latter isn't actually guaranteed: if one batch job exits with a failure status, the driver will exit as well, assuming there's no point in continuing. Fortunately, we do have a flag that overrides this behavior, -continue-building-after-errors. (As noted in the patch, -continue-building-after-errors isn't *exactly* what we want. But it's conservatively correct.) (cherry picked from commit 606ee29)
The logic in #16485 to avoid putting certain diagnostics into serialized diagnostic files only makes sense if
every diagnostic emitted in file A.swift while processing a different file B.swift would be emitted if we processed A.swift on its own
we actually do process A.swift on its own in the same build, or have previously done an incremental build and produced the same diagnostic
But the latter isn't actually guaranteed: if one batch job exits with a failure status, the driver will exit as well, assuming there's no point in continuing. Fortunately, we do have a flag that overrides this behavior,
-continue-building-after-errors
.(As noted in the patch,
-continue-building-after-errors
isn't exactly what we want. But it's conservatively correct.)