[cfe-dev] Straw poll: -verify and fatal errors

Richard Smith richard at metafoo.co.uk
Mon Jul 9 15:08:14 PDT 2012


On Mon, Jul 9, 2012 at 2:14 PM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:

> Hi all,
>
> I am working on a series of patches to enhance and fix the -verify feature
> of clang, but one thing in particular has raised some questions which
> myself
> and Mr. Rose would appreciate some input on!
>
> For those not familiar with the -verify feature, here is a very brief
> description taken from the clang internals web-page: "Instead of formatting
> and printing out the diagnostics, -verify just captures and remembers the
> diagnostics as they fly by. Then -verify compares the list of produced
> diagnostics to the list of expected ones. If they disagree, it prints out
> its own output."  It is a feature commonly used in writing test cases for
> clang, but also has the potential to be used for non-related projects.
>
> The question at hand here relates to how -verify should handle fatal errors
> generated within test cases.  At the moment, -verify doesn't handle them at
> all: it cannot be used to check for the generation of fatal errors, nor
> does
> it provide any diagnostics back to the user.
>

For those not following on cfe-commits, this is an inaccurate summary. We
use -verify to check fatal errors in a few tests (for
instance, test/SemaTemplate/instantiation-depth*), and it works, but if the
test fails then -verify is unable to produce a diagnostic explaining why,
because all diagnostics are suppressed after a fatal error:

$ echo '#include "does not exist" // expected-error {{wrong error}}' |
clang -cc1 -x c - -verify; echo $?
2 errors generated.
1
$ echo '#include "does not exist" // expected-error {{file not found}}' |
clang -cc1 -x c - -verify; echo $?
0
$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120709/1b36fac1/attachment.html>


More information about the cfe-dev mailing list