Skip to content

[4.2] Fixes for batch mode diagnostics in Xcode #16529

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

Conversation

jrose-apple
Copy link
Contributor

Cherry-pick of

This is fallout from #14900, which was the first attempt to deal with batch mode being different from single-file mode in terms of what diagnostics get produced and where. There was a hole in that scheme, however: if processing B.swift results in a diagnostic being emitted in A.swift (and B.swift and A.swift are in different batches), that diagnostic would appear in every file in the same batch as B.swift. This (1) looks bad in Xcode's Log Editor, and (2) could result in a diagnostic that never goes away. (How? Fix the problem in A.swift, and A.swift and B.swift will get rebuilt…but not necessarily other files in B.swift's original batch.)

These changes together attempt to enforce two rules:

  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)

and use those guarantees to avoid emitting diagnostics located in A.swift altogether if A.swift isn't in the current batch.

jrose-apple and others added 3 commits May 10, 2018 21:47
Make sure protocol witness errors don't leave the conformance context

(cherry picked from commit 88169d6)
[Batch Mode] Suppressing diagnostics for non-primaries - rdar://40032762

(cherry picked from commit 46b8ad3)
…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
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@jrose-apple jrose-apple merged commit 9f09361 into swiftlang:swift-4.2-branch May 11, 2018
@jrose-apple jrose-apple deleted the 4.2-batch-mode-diagnostics branch May 11, 2018 18:14
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.

1 participant