<div class="gmail_quote">On Mon, Jul 9, 2012 at 2:14 PM, Andy Gibbs <span dir="ltr"><<a href="mailto:andyg1001@hotmail.co.uk" target="_blank">andyg1001@hotmail.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I am working on a series of patches to enhance and fix the -verify feature<br>
of clang, but one thing in particular has raised some questions which myself<br>
and Mr. Rose would appreciate some input on!<br>
<br>
For those not familiar with the -verify feature, here is a very brief<br>
description taken from the clang internals web-page: "Instead of formatting<br>
and printing out the diagnostics, -verify just captures and remembers the<br>
diagnostics as they fly by. Then -verify compares the list of produced<br>
diagnostics to the list of expected ones. If they disagree, it prints out<br>
its own output."  It is a feature commonly used in writing test cases for<br>
clang, but also has the potential to be used for non-related projects.<br>
<br>
The question at hand here relates to how -verify should handle fatal errors<br>
generated within test cases.  At the moment, -verify doesn't handle them at<br>
all: it cannot be used to check for the generation of fatal errors, nor does<br>
it provide any diagnostics back to the user.<br></blockquote><div><br></div><div>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:</div>
<div><br></div><div><div><font face="courier new, monospace">$ echo '#include "does not exist" // expected-error {{wrong error}}' | clang -cc1 -x c - -verify; echo $?</font></div><div><font face="courier new, monospace">2 errors generated.</font></div>
<div><font face="courier new, monospace">1</font></div><div><font face="courier new, monospace">$ echo '#include "does not exist" // expected-error {{file not found}}' | clang -cc1 -x c - -verify; echo $?</font></div>
</div><div><font face="courier new, monospace">0</font></div><div><font face="courier new, monospace">$</font></div></div>