<div dir="ltr">On Tue, Apr 9, 2013 at 5:47 PM, David Tweed <span dir="ltr"><<a href="mailto:david.tweed@arm.com" target="_blank">david.tweed@arm.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, I haven't been following the formatter patches (partly because it looks like a big collection of different cases and I don't really have the time to devote to understanding it) so this is maybe naive or has been done before, but presumably formatting isn't that performance sensitive so is there scope for (ab)using some of the C++ language to remove some of the redundancy from big lists of what the token is not (not just in this patch but in the formatter in general)? It'd make the code a bit more approachable...<br>
</blockquote><div><br></div><div style>We already have AnnotatedToken::isOneOf, and maybe I'll move it to FormatToken some time later.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
Index: lib/Format/UnwrappedLineParser.cpp<br>
===================================================================<br>
--- lib/Format/UnwrappedLineParser.cpp<br>
+++ lib/Format/UnwrappedLineParser.cpp<br>
@@ -386,11 +386,31 @@<br>
parseLabel();<br>
return;<br>
}<br>
- // Recognize function-like macro usages without trailing semicolon in<br>
- // declaration context.<br>
+ // Recognize function-like macro usages without trailing semicolon.<br>
if (<a href="http://FormatTok.Tok.is" target="_blank">FormatTok.Tok.is</a>(tok::l_paren)) {<br>
parseParens();<br>
- if (Line->MustBeDeclaration && FormatTok.HasUnescapedNewline) {<br>
+ if (FormatTok.HasUnescapedNewline && FormatTok.Tok.isNot(tok::semi) &&<br>
+ FormatTok.Tok.isNot(tok::l_brace) &&<br>
+ FormatTok.Tok.isNot(tok::l_square) &&<br>
+ FormatTok.Tok.isNot(tok::period) &&<br>
+ FormatTok.Tok.isNot(tok::arrow) &&<br>
+ FormatTok.Tok.isNot(tok::arrowstar) &&<br>
+ FormatTok.Tok.isNot(tok::lessless) &&<br>
+ FormatTok.Tok.isNot(tok::colon) &&<br>
+ FormatTok.Tok.isNot(tok::plusplus) &&<br>
+ FormatTok.Tok.isNot(tok::minusminus) &&<br>
+ FormatTok.Tok.isNot(tok::equal) &&<br>
+ FormatTok.Tok.isNot(tok::plusequal) &&<br>
+ FormatTok.Tok.isNot(tok::minusequal) &&<br>
+ FormatTok.Tok.isNot(tok::starequal) &&<br>
+ FormatTok.Tok.isNot(tok::slashequal) &&<br>
+ FormatTok.Tok.isNot(tok::percentequal) &&<br>
+ FormatTok.Tok.isNot(tok::ampequal) &&<br>
+ FormatTok.Tok.isNot(tok::pipeequal) &&<br>
+ FormatTok.Tok.isNot(tok::caretequal) &&<br>
+ FormatTok.Tok.isNot(tok::greatergreaterequal) &&<br>
+ FormatTok.Tok.isNot(tok::lesslessequal) &&<br>
+ FormatTok.Tok.isNot(tok::kw_try)) {<br>
addUnwrappedLine();<br>
return;<br>
}<br>
<br>
<br>
<br>
<br>
</div></div>_______________________________________________<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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div><font color="#666666"><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(213,15,37);border-right-color:rgb(213,15,37);border-bottom-color:rgb(213,15,37);border-left-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Alexander Kornienko |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(51,105,232);border-right-color:rgb(51,105,232);border-bottom-color:rgb(51,105,232);border-left-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Software Engineer |</span></font><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(0,153,57);border-right-color:rgb(0,153,57);border-bottom-color:rgb(0,153,57);border-left-color:rgb(0,153,57);padding-top:2px;margin-top:2px"><font color="#666666"> </font><a href="mailto:alexfh@google.com" style="color:rgb(17,85,204)" target="_blank">alexfh@google.com</a> |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(238,178,17);border-right-color:rgb(238,178,17);border-bottom-color:rgb(238,178,17);border-left-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a value="+35315435283" style="color:rgb(17,85,204)">+49 151 221 77 957</a></span></div>
</div><div><font color="#666666"><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Google Germany GmbH | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Dienerstr. 12 | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">80331 München</span></font></div>
</div></div>