<div dir="ltr">That is weird as I tested that locally and that was one of the cases I checked. And it wouldn't have exercised the code path that caused problems last time. I tried reproducing locally as follows:<div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_USE_SANITIZER=Address -DLLVM_USE_SANITIZE_COVERAGE=YES -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release ../ && ninja -j 10 clang-</span><span style="color:rgb(0,0,0)">format</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">printf "<<<" | ASAN_OPTIONS=coverage=1 ./bin/clang-format</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">ninja clang-format-fuzzer</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">./bin/clang<!--
-->-format-fuzzer corpus/</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">But none of the tests gave me an error. So if I was doing it correctly, then the only other thing I could think of is</span> that the bot was using an older revision. I didn't see the revision number in the error report. Is this possible?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 22, 2015 at 1:43 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't think this is a complete fix. <div>The fuzzer is still unhappy, this time on <<<</div><div><!--
--><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/442/steps/stage2%2Fasan%20run%20clang-format-fuzzer/logs/stdio" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/442/steps/stage2%2Fasan%20run%20clang-format-fuzzer/logs/stdio</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 1:09 PM, Jacques Pienaar <span dir="ltr"><<a href="mailto:jpienaar@google.com" target="_blank">jpienaar@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jpienaar<br>
Date: Fri Feb 20 15:09:01 2015<br>
New Revision: 230061<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=230061&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=230061&view=rev</a><br>
Log:<br>
Fix merging of << at end of input.<br>
<br>
Commit of review <a href="http://reviews.llvm.org/D7766" target="_blank">http://reviews.llvm.org/D7766</a><br>
<br>
<br>
Modified:<br>
cfe/trunk/lib/Format/Format.cpp<br>
cfe/trunk/unittests/Format/FormatTest.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/Format.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=230061&r1=230060&r2=230061&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=230061&r1=230060&r2=230061&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Format/Format.cpp (original)<br>
+++ cfe/trunk/lib/Format/Format.cpp Fri Feb 20 15:09:01 2015<br>
@@ -662,33 +662,26 @@ private:<br>
<br>
bool tryMergeLessLess() {<br>
// Merge X,less,less,Y into X,lessless,Y unless X or Y is less.<br>
- if (Tokens.size() < 4) {<br>
- // Merge <,<,eof to <<,eof<br>
- if (Tokens.back()->Tok.isNot(tok::eof))<br>
- return false;<br>
+ if (Tokens.size() < 3)<br>
+ return false;<br>
<br>
- auto &eof = Tokens.back();<br>
- Tokens.pop_back();<br>
- bool LessLessMerged;<br>
- if ((LessLessMerged = tryMergeTokens({tok::less, tok::less})))<br>
- Tokens.back()->Tok.setKind(tok::lessless);<br>
- Tokens.push_back(eof);<br>
- return LessLessMerged;<br>
- }<br>
+ bool FourthTokenIsLess = false;<br>
+ if (Tokens.size() > 3)<br>
+ FourthTokenIsLess = (Tokens.end() - 4)[0]->is(tok::less);<br>
<br>
- auto First = Tokens.end() - 4;<br>
- if (First[3]->is(tok::less) || First[2]->isNot(tok::less) ||<br>
- First[1]->isNot(tok::less) || First[0]->is(tok::less))<br>
+ auto First = Tokens.end() - 3;<br>
+ if (First[2]->is(tok::less) || First[1]->isNot(tok::less) ||<br>
+ First[0]->isNot(tok::less) || FourthTokenIsLess)<br>
return false;<br>
<br>
// Only merge if there currently is no whitespace between the two "<".<br>
- if (First[2]->WhitespaceRange.getBegin() !=<br>
- First[2]->WhitespaceRange.getEnd())<br>
+ if (First[1]->WhitespaceRange.getBegin() !=<br>
+ First[1]->WhitespaceRange.getEnd())<br>
return false;<br>
<br>
- First[1]->Tok.setKind(tok::lessless);<br>
- First[1]->TokenText = "<<";<br>
- First[1]->ColumnWidth += 1;<br>
+ First[0]->Tok.setKind(tok::lessless);<br>
+ First[0]->TokenText = "<<";<br>
+ First[0]->ColumnWidth += 1;<br>
Tokens.erase(Tokens.end() - 2);<br>
return true;<br>
}<br>
<br>
Modified: cfe/trunk/unittests/Format/FormatTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=230061&r1=230060&r2=230061&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=230061&r1=230060&r2=230061&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Feb 20 15:09:01 2015<br>
@@ -9752,6 +9752,7 @@ TEST_F(FormatTest, TripleAngleBrackets)<br>
}<br>
<br>
TEST_F(FormatTest, MergeLessLessAtEnd) {<br>
+ verifyFormat("<<");<br>
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"<br>
"aaallvm::outs() <<");<br>
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div>