Skip to content

If -verify mode saw unexpected diagnostics, print diagnostics from all files. #30028

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 6 commits into from
Mar 3, 2020

Conversation

martinboehme
Copy link
Contributor

This PR causes any remaining diagnostics that weren't in the input file to be output if there were unexpected diagnostics in -verify mode.

As an example of how this is useful, consider the case where ClangImporter fails with

"unexpected` error produced: could not build C module 'some_module'"

It would be useful to know what the underlying Clang error was that caused building the module to fail, but so far, -verify mode would not output that; to get the error, it would be necessary to run the compiler invocation again without -verify.

The PR adds a test that exercises this use case.

I'm also adding some basic tests for the -verify functionality generally, which didn't seem to exist.

@gribozavr
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 998abf7f955c1ac48c66b686d439f5a4f72628d0

@gribozavr
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 998abf7f955c1ac48c66b686d439f5a4f72628d0

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 998abf7f955c1ac48c66b686d439f5a4f72628d0

@gribozavr
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - a7e44e0d6a8406e01ae281ddb353d7c223c9c092

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a7e44e0d6a8406e01ae281ddb353d7c223c9c092

@gribozavr
Copy link
Contributor

@swift-ci Please test

…all files.

As an example of how this is useful, consider the case where
ClangImporter fails with

  "unexpected error produced: could not build C module 'ctypes'"

It would be useful to know what the underlying Clang error was that
caused building the module to fail, but so far, `-verify` mode would not
output that; to get the error, it would be necessary to run the compiler
invocation again without `-verify`.

This change causes any remaining diagnostics that weren't in the input file
to be output if there were unexpected diagnostics in `-verify` mode.

I haven't added any tests for this because I didn't find a place that
contains tests for the `-verify` functionality itself (as opposed to
tests that use `-verify` mode). I think the large number of tests that
run with `-verify` should at least ensure, however, that this change
does not regress anything.
A header shouldn't contain a function body unless the function is
inline. Following gribozavr's suggestion, I'm using the easier solution
of omitting the semicolon from the function prototype.

(In response to review comments.)
Shorten expected error message so that it doesn't expect "C module" (and
breaks if presented with "Objective-C module").
@martinboehme
Copy link
Contributor Author

Pushed a rebase to get off a bad version with failing LLDB tests. Please retest.

@gribozavr
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - f81ef9c

@gribozavr
Copy link
Contributor

@swift-ci Please test Linux

@gribozavr gribozavr self-requested a review March 3, 2020 09:08
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.

3 participants