<div dir="ltr">Yeah, fair - thanks for the explanation/correction/etc. <br><br>That does seem a bit odd. Dunno.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 7, 2016 at 10:54 PM, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Nope. Sorry, your expectation is incorrect.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">"BETWEEN BEFORE AFTER" would be accepted, because: (1) the first –DAG matches BEFORE; (2) the –NOT range starts at the preceding match-point, i.e. the (end
of the) BEFORE, thus does not find BETWEEN; (3) the second –DAG starts at the same point as the –NOT.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">That is, the first –DAG and the following –NOT *are* ordered; the –NOT and the subsequent –DAG are *not* ordered.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You most certainly cannot intermix them freely and expect them all to look at the same range; that is explicitly not the documented (or actual) behavior.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="34590580__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Monday, March 07, 2016 8:43 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] FileCheck: combining -DAG and -NOT<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">I'd probably have expected the behavior it has - that -DAG and -NOT are not ordered with respect to each other, and form a bag of things ordered with respect to enclosing CHECK:s.<br>
<br>
If you want to try turning it into an error, you could find all the places we do use interspersed -DAG and -NOT and have a discussion about whether they're more buggy than they are useful/correct.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Mar 7, 2016 at 5:39 PM, Robinson, Paul via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">If you look at the FileCheck documentation page:<br>
<a href="http://llvm.org/docs/CommandGuide/FileCheck.html" target="_blank">http://llvm.org/docs/CommandGuide/FileCheck.html</a><br>
you'll find this intriguing example of combining -DAG with -NOT<br>
(slightly amended to avoid some potential confusion):<br>
<br>
; CHECK-DAG: BEFORE<br>
; CHECK-NOT: BETWEEN<br>
; CHECK-DAG: AFTER<br>
<br>
The page says this will reject the sequence "AFTER BEFORE", which is<br>
correct. It's intuitively obvious that it will also reject the text<br>
"BEFORE BETWEEN AFTER" as well.<br>
<br>
Pop Quiz: Will it accept or reject "BEFORE AFTER BETWEEN"?<br>
No, don't go try it, that's cheating; what do you *think* will happen?<br>
Take a minute, I won't mind.<br>
---<br>
<br>
So, here's the story.<br>
<br>
Normally a -NOT line will scan the text between the points where the<br>
preceding and following CHECK lines match. By that mental model, you'd<br>
expect the first -DAG to find BEFORE, the second -DAG to find AFTER, and<br>
then -NOT would verify the absence of "BETWEEN" between those two points.<br>
All very intuitive, and I've certainly seen tests written to expect that.<br>
<br>
However, things get a little funky when you have -NOT followed by -DAG.<br>
What's the endpoint of the -NOT search? The thing that follows isn't<br>
a CHECK, it's a CHECK-DAG, except that -NOT is already kind of DAG-ish<br>
so you have two DAG-ish groups staring at each other wondering who will<br>
go first.<br>
<br>
In this case, turns out, it's the -NOT who blinks first. The endpoint<br>
of the search is implicitly the end-of-input. The Pop Quiz answer is:<br>
*Rejected.* The BETWEEN occurs after BEFORE, and before the end-of-input.<br>
<br>
Here's the real question: *Should* FileCheck run the second -DAG group<br>
before it runs the -NOT group? Then the range for the -NOT would be<br>
bounded by the matching points for the surrounding -DAG lines, which<br>
probably matches what basically everybody expects to happen.<br>
<br>
Or, leave things as they are, and add a cautionary tale to the FileCheck<br>
documentation page? Given there's an actual documentation example, it<br>
would seem inappropriate to make it an *error* if a -NOT is followed<br>
by a -DAG!<br>
<br>
Thanks,<br>
--paulr<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br></div>