<div dir="ltr">You already added them in r172023. I think they are a good addition.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 10:51 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks!<br>
<br>
Any thoughts about the assert() calls I suggested on the bug?<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Jan 10, 2013 at 1:26 AM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
> Author: djasper<br>
> Date: Thu Jan 10 03:26:47 2013<br>
> New Revision: 172049<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=172049&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=172049&view=rev</a><br>
> Log:<br>
> Do more error checking for '{}'.<br>
><br>
> This fixes <a href="http://llvm.org/PR14883" target="_blank">llvm.org/PR14883</a>, where clang-format would run into an<br>
> assertion on:<br>
><br>
> void f() { return } 42<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=172049&r1=172048&r2=172049&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=172049&r1=172048&r2=172049&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Format/Format.cpp (original)<br>
> +++ cfe/trunk/lib/Format/Format.cpp Thu Jan 10 03:26:47 2013<br>
> @@ -651,6 +651,21 @@<br>
> return false;<br>
> }<br>
><br>
> + bool parseBrace() {<br>
> + while (CurrentToken != NULL) {<br>
> + if (CurrentToken->is(tok::r_brace)) {<br>
> + next();<br>
> + return true;<br>
> + }<br>
> + if (CurrentToken->is(tok::r_paren) || CurrentToken->is(tok::r_square))<br>
> + return false;<br>
> + if (!consumeToken())<br>
> + return false;<br>
> + }<br>
> + // Lines can currently end with '{'.<br>
> + return true;<br>
> + }<br>
> +<br>
> bool parseConditional() {<br>
> while (CurrentToken != NULL) {<br>
> if (CurrentToken->is(tok::colon)) {<br>
> @@ -693,6 +708,10 @@<br>
> if (!parseSquare())<br>
> return false;<br>
> break;<br>
> + case tok::l_brace:<br>
> + if (!parseBrace())<br>
> + return false;<br>
> + break;<br>
> case tok::less:<br>
> if (parseAngle())<br>
> Tok->Type = TT_TemplateOpener;<br>
> @@ -705,6 +724,11 @@<br>
> case tok::r_paren:<br>
> case tok::r_square:<br>
> return false;<br>
> + case tok::r_brace:<br>
> + // Lines can start with '}'.<br>
> + if (Tok->Parent != NULL)<br>
> + return false;<br>
> + break;<br>
> case tok::greater:<br>
> Tok->Type = TT_BinaryOperator;<br>
> break;<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=172049&r1=172048&r2=172049&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=172049&r1=172048&r2=172049&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
> +++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Jan 10 03:26:47 2013<br>
> @@ -1036,6 +1036,10 @@<br>
> // Error recovery tests.<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> +TEST_F(FormatTest, IncorrectCodeTrailingStuff) {<br>
> + verifyFormat("void f() { return } 42");<br>
> +}<br>
> +<br>
> TEST_F(FormatTest, IndentationWithinColumnLimitNotPossible) {<br>
> verifyFormat("int aaaaaaaa =\n"<br>
> " // Overly long comment\n"<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">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>
</div></div></blockquote></div><br></div>