<div dir="ltr">Ok.. :-/ ...</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 22, 2013 at 4:30 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"><div class="im">On Tue, Jan 22, 2013 at 3:46 AM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
> Author: djasper<br>
> Date: Tue Jan 22 05:46:26 2013<br>
> New Revision: 173150<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=173150&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=173150&view=rev</a><br>
> Log:<br>
> Fix "*" formatting when creating arrays of pointers.<br>
><br>
> Before: A = new int * [10]();<br>
> After: A = new int *[10]();<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=173150&r1=173149&r2=173150&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=173150&r1=173149&r2=173150&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Format/Format.cpp (original)<br>
> +++ cfe/trunk/lib/Format/Format.cpp Tue Jan 22 05:46:26 2013<br>
> @@ -958,6 +958,13 @@<br>
><br>
> while (CurrentToken != NULL) {<br>
> if (CurrentToken->is(tok::r_square)) {<br>
> + if (!CurrentToken->Children.empty() &&<br>
> + CurrentToken->Children[0].is(tok::l_paren)) {<br>
> + // An ObjC method call can't be followed by an open parenthesis.<br>
<br>
</div>I think it can, if the ObjC method returns a function pointer for example.<br>
<div class="HOEnZb"><div class="h5"><br>
> + // FIXME: Do we incorrectly label ":" with this?<br>
> + StartsObjCMethodExpr = false;<br>
> + Left->Type = TT_Unknown;<br>
> + }<br>
> if (StartsObjCMethodExpr)<br>
> objCSelector.markEnd(*CurrentToken);<br>
> Left->MatchingParen = CurrentToken;<br>
> @@ -1325,6 +1332,9 @@<br>
> if (NextToken == NULL)<br>
> return TT_Unknown;<br>
><br>
> + if (NextToken->is(tok::l_square) && NextToken->Type != TT_ObjCMethodExpr)<br>
> + return TT_PointerOrReference;<br>
> +<br>
> if (PrevToken->is(tok::l_paren) || PrevToken->is(tok::l_square) ||<br>
> PrevToken->is(tok::l_brace) || PrevToken->is(tok::comma) ||<br>
> PrevToken->is(tok::kw_return) || PrevToken->is(tok::colon) ||<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=173150&r1=173149&r2=173150&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=173150&r1=173149&r2=173150&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
> +++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Jan 22 05:46:26 2013<br>
> @@ -1338,6 +1338,9 @@<br>
> verifyFormat("if (*b[i])");<br>
> verifyFormat("if (int *a = (&b))");<br>
> verifyFormat("while (int *a = &b)");<br>
> +<br>
> + verifyFormat("A = new SomeType *[Length]();");<br>
> + verifyGoogleFormat("A = new SomeType* [Length]();");<br>
> }<br>
><br>
> TEST_F(FormatTest, FormatsCasts) {<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>