Skip to content

[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

Merged
merged 1 commit into from
May 11, 2018

Conversation

jrose-apple
Copy link
Contributor

The logic in #16485 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.)

@jrose-apple jrose-apple requested review from graydon and davidungar May 11, 2018 01:30
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@davidungar davidungar left a 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.

@@ -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
Copy link
Contributor

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.

// 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;
Copy link
Contributor

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.

Copy link
Contributor

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.)
@jrose-apple jrose-apple force-pushed the but-it-is-not-this-day branch from 2b9c230 to f9fd6a3 Compare May 11, 2018 03:02
@jrose-apple
Copy link
Contributor Author

Updated!

@swift-ci Please smoke test

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jrose-apple jrose-apple merged commit 606ee29 into swiftlang:master May 11, 2018
@jrose-apple jrose-apple deleted the but-it-is-not-this-day branch May 11, 2018 04:44
jrose-apple added a commit to jrose-apple/swift that referenced this pull request May 11, 2018
…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)
jrose-apple added a commit to jrose-apple/swift that referenced this pull request May 11, 2018
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants