<div dir="ltr">If this only affects error messages, could we simply teach FileCheck some heuristics for bounding the region of the intended match, based on common patterns like 'CHECK: define ...', 'CHECK: asdf:', or 'CHECK: }' ?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 29, 2013 at 1:51 PM, Stephen Lin <span dir="ltr"><<a href="mailto:swlin@post.harvard.edu" target="_blank">swlin@post.harvard.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Anyone have any thoughts on this? :)<br>
<span class="HOEnZb"><font color="#888888">-Stephen<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
---------- Forwarded message ----------<br>
From: Stephen Lin <<a href="mailto:swlin@post.harvard.edu">swlin@post.harvard.edu</a>><br>
Date: Sat, May 18, 2013 at 5:36 PM<br>
Subject: [PATCH] Add CHECK-UNIQ directive to FileCheck to allow more<br>
accurate error messages and error recovery<br>
To: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
Cc: Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>><br>
<br>
<br>
Hi,<br>
<br>
This patch adds a new directive, CHECK-UNIQ, which is meant to be used<br>
to match unique identifier lines (like labels).<br>
<br>
If present in a match file, FileCheck will use these directives to<br>
split the input into blocks that are independently processed, ensuring<br>
that a CHECK does not inadvertently match a line in a different block<br>
(which can lead to a misleading/useless error message when the error<br>
is eventually caught). Also, FileCheck can now recover from errors<br>
within blocks by continuing to the next block.<br>
<br>
Please let me know if you have any comments or suggestions.<br>
<br>
Also, if people like this idea, I will also script a mass update of<br>
tests to use CHECK-UNIQ in common cases, like assembly labels and IR<br>
function definition lines. (I will include a sanity check to make sure<br>
each pattern does indeed uniquely match a single line of the input<br>
before updating.)<br>
<br>
Stephen<br>
<br>
---------- Forwarded message ----------<br>
From: Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>><br>
Date: Thu, Apr 25, 2013 at 10:37 AM<br>
Subject: Re: [LLVMdev] Minor FileCheck proposal: CHECK-UNIQUE for<br>
labels to improve error messages<br>
To: Stephen Lin <<a href="mailto:swlin@post.harvard.edu">swlin@post.harvard.edu</a>><br>
Cc: llvmdev <<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>><br>
<br>
<br>
On Wed, Apr 24, 2013 at 8:05 PM, Stephen Lin <<a href="mailto:swlin@post.harvard.edu">swlin@post.harvard.edu</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Apologies if this has been proposed before; I couldn't find anything<br>
> in basic searching.<br>
><br>
> I've been writing tests lately and noticed that the error messages are<br>
> not very helpful in cases where a check is incorrect but matches<br>
> something that occurs in a later block: the checker continues assuming<br>
> that the matched line is correct (no matter how much farther ahead it<br>
> occurs) and then provides a misleading error message some time later.<br>
><br>
> The problem is exacerbated if many similar tests are put in one file,<br>
> since many checks can end up succeeding with unintended matches before<br>
> something ends up failing.<br>
><br>
> I propose a simple addition to FileCheck syntax to improve error<br>
> messages in this case: a CHECK-UNIQUE directive which indicates that a<br>
> given check is a unique match that should only occur once (and only<br>
> once) in a given file and can only be matched with the given<br>
> CHECK-UNIQUE; this would be used for labels or any other unique<br>
> identifier lines.<br>
><br>
> The CHECK-UNIQUE lines can then allow a better error message to be<br>
> produced, by basically treating each section between CHECK-UNIQUE<br>
> lines separately, so the actual line causing the error can be<br>
> pinpointed more accurately.<br>
><br>
> Anyone else thing this is a good idea? I'm happy to work on this if so.<br>
<br>
<br>
I like this idea. There are many places in the test cases where this<br>
idiom is needed and currently CHECK followed by a CHECK-NOT is used,<br>
which is cumbersome.<br>
<br>
Eli<br>
</div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>