<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Nope.  Sorry, your expectation is incorrect.<o:p></o:p></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.<o:p></o:p></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.<o:p></o:p></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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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:dblaikie@gmail.com]
<br>
<b>Sent:</b> Monday, March 07, 2016 8:43 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] FileCheck: combining -DAG and -NOT<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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:<o:p></o:p></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">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><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>