<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr">Well, there are two additional spaces.<div><br></div><div>One is before the "*". This is not present in google-style and there is a FIXME in the test to look into that for LLVM style (and I referenced it on the bug report).</div>
<div><br></div><div>Thus, I thought you were referring to the second, the space after ")".</div><div><br></div><div style>Both will be addressed.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Jan 2, 2013 at 5:13 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 Wed, Jan 2, 2013 at 8:03 AM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
><br>
><br>
><br>
> On Wed, Jan 2, 2013 at 4:52 PM, Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:<br>
>><br>
>> On Wed, Jan 2, 2013 at 7:47 AM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
>> > Author: djasper<br>
>> > Date: Wed Jan  2 09:46:59 2013<br>
>> > New Revision: 171390<br>
>> ><br>
>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=171390&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=171390&view=rev</a><br>
>> > Log:<br>
>> > Correctly format pointers and references in casts.<br>
>><br>
>> Cool!<br>
>><br>
>> ><br>
>> > This fixes <a href="http://llvm.org/PR14747" target="_blank">llvm.org/PR14747</a>.<br>
>> ><br>
>> > Before: Type *A = (Type * ) P;<br>
>> > After:  Type *A = (Type *) P;<br>
>><br>
>> Shouldn't this be "(Type*)P" though? At least for google style? (It<br>
>> feels like that's more common in clang too, but I haven't checked if<br>
>> that's true.)<br>
><br>
><br>
> I think you are right. It has been quite a while since I have used this type<br>
> of cast.. ;-)<br>
<br>
</div>I meant static_cast too. Since that's easy to grep for, this time with data:<br>
<br>
Nicos-MacBook-Pro:clang thakis$ ack 'static_cast[^>]*[ ]\*>' lib | wc -l<br>
      89<br>
Nicos-MacBook-Pro:clang thakis$ ack 'static_cast[^>]*[^ ]\*>' lib | wc -l<br>
     162<br>
<div class="im"><br>
> It is a separate issue, though. I will address it soon.<br>
<br>
</div>Thanks!<br>
<div class="HOEnZb"><div class="h5"><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:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=171390&r1=171389&r2=171390&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=171390&r1=171389&r2=171390&view=diff</a><br>

>> ><br>
>> > ==============================================================================<br>
>> > --- cfe/trunk/lib/Format/Format.cpp (original)<br>
>> > +++ cfe/trunk/lib/Format/Format.cpp Wed Jan  2 09:46:59 2013<br>
>> > @@ -822,19 +822,23 @@<br>
>> >    TokenAnnotation::TokenType determineStarAmpUsage(unsigned Index, bool<br>
>> > IsRHS) {<br>
>> >      if (Index == Annotations.size())<br>
>> >        return TokenAnnotation::TT_Unknown;<br>
>> > +    const FormatToken &PrevToken = Line.Tokens[Index - 1];<br>
>> > +    const FormatToken &NextToken = Line.Tokens[Index + 1];<br>
>> ><br>
>> > -    if (Index == 0 || Line.Tokens[Index - 1].Tok.is(tok::l_paren) ||<br>
>> > -        Line.Tokens[Index - 1].Tok.is(tok::comma) ||<br>
>> > -        Line.Tokens[Index - 1].Tok.is(tok::kw_return) ||<br>
>> > -        Line.Tokens[Index - 1].Tok.is(tok::colon) ||<br>
>> > +    if (Index == 0 || <a href="http://PrevToken.Tok.is" target="_blank">PrevToken.Tok.is</a>(tok::l_paren) ||<br>
>> > +        <a href="http://PrevToken.Tok.is" target="_blank">PrevToken.Tok.is</a>(tok::comma) ||<br>
>> > <a href="http://PrevToken.Tok.is" target="_blank">PrevToken.Tok.is</a>(tok::kw_return) ||<br>
>> > +        <a href="http://PrevToken.Tok.is" target="_blank">PrevToken.Tok.is</a>(tok::colon) ||<br>
>> >          Annotations[Index - 1].Type ==<br>
>> > TokenAnnotation::TT_BinaryOperator)<br>
>> >        return TokenAnnotation::TT_UnaryOperator;<br>
>> ><br>
>> > -    if (Line.Tokens[Index - 1].Tok.isLiteral() ||<br>
>> > -        Line.Tokens[Index + 1].Tok.isLiteral() ||<br>
>> > -        Line.Tokens[Index + 1].Tok.is(tok::kw_sizeof))<br>
>> > +    if (PrevToken.Tok.isLiteral() || NextToken.Tok.isLiteral() ||<br>
>> > +        <a href="http://NextToken.Tok.is" target="_blank">NextToken.Tok.is</a>(tok::kw_sizeof))<br>
>> >        return TokenAnnotation::TT_BinaryOperator;<br>
>> ><br>
>> > +    if (<a href="http://NextToken.Tok.is" target="_blank">NextToken.Tok.is</a>(tok::comma) || <a href="http://NextToken.Tok.is" target="_blank">NextToken.Tok.is</a>(tok::r_paren)<br>
>> > ||<br>
>> > +        <a href="http://NextToken.Tok.is" target="_blank">NextToken.Tok.is</a>(tok::greater))<br>
>> > +      return TokenAnnotation::TT_PointerOrReference;<br>
>> > +<br>
>> >      // It is very unlikely that we are going to find a pointer or<br>
>> > reference type<br>
>> >      // definition on the RHS of an assignment.<br>
>> >      if (IsRHS)<br>
>> ><br>
>> > Modified: cfe/trunk/unittests/Format/FormatTest.cpp<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171390&r1=171389&r2=171390&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171390&r1=171389&r2=171390&view=diff</a><br>

>> ><br>
>> > ==============================================================================<br>
>> > --- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
>> > +++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan  2 09:46:59 2013<br>
>> > @@ -699,6 +699,9 @@<br>
>> >    verifyFormat("A<int **> a;");<br>
>> >    verifyFormat("A<int *, int *> a;");<br>
>> >    verifyFormat("A<int **, int **> a;");<br>
>> > +  verifyFormat("Type *A = static_cast<Type *>(P);");<br>
>> > +  verifyFormat("Type *A = (Type *) P;");<br>
>> > +  verifyFormat("Type *A = (vector<Type *, int *>) P;");<br>
>> ><br>
>> >    verifyGoogleFormat("int main(int argc, char** argv) {\n}");<br>
>> >    verifyGoogleFormat("A<int*> a;");<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>
><br>
><br>
</div></div></blockquote></div><br></div></div>