[4.2] [BatchMode] Consolidate reasoning about -{enable,disable}-batch-mode flag. #15754
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of changes in #15749
EDIT: plus a ride-along of #15556 that disables a flaky test.
Original description:
Previous to this change, the initial inspection of the -{enable,disable}-batch-mode flag was made separate from the subsequent overriding by -wmo; this in turn meant that the driver might decide it's "in batch mode" in one place (in particular, when judging whether to ignore the -num-threads flag) and "in wmo mode" elsewhere (when judging whether to emit one or multiple outputs, which depends on the -num-threads flag).
Divergence between these two views caused the driver to effectively drop the -num-threads flag even when overriding batch mode with wmo; since xcode assumes that passing -wmo -num-threads will cause multiple outputs, this in turn caused linking to fail since the expected output files were not found.
rdar://39191323