r176252 - No spaces around pointers to members.

Jordan Rose jordan_rose at apple.com
Thu Feb 28 09:20:52 PST 2013


What about .*?


On Feb 28, 2013, at 5:40 , Daniel Jasper <djasper at google.com> wrote:

> Author: djasper
> Date: Thu Feb 28 07:40:17 2013
> New Revision: 176252
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=176252&view=rev
> Log:
> No spaces around pointers to members.
> 
> Before: (a ->* f)()
> After:  (a->*f)()
> 
> Modified:
>    cfe/trunk/lib/Format/TokenAnnotator.cpp
>    cfe/trunk/unittests/Format/FormatTest.cpp
> 
> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=176252&r1=176251&r2=176252&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Feb 28 07:40:17 2013
> @@ -1027,6 +1027,8 @@ bool TokenAnnotator::spaceRequiredBefore
> 
>   if (Tok.Parent->is(tok::comma))
>     return true;
> +  if (Tok.is(tok::comma))
> +    return false;
>   if (Tok.Type == TT_CtorInitializerColon || Tok.Type == TT_ObjCBlockLParen)
>     return true;
>   if (Tok.Parent->FormatTok.Tok.is(tok::kw_operator))
> @@ -1048,8 +1050,9 @@ bool TokenAnnotator::spaceRequiredBefore
>            Tok.Parent->Type == TT_TemplateCloser &&
>            Style.Standard != FormatStyle::LS_Cpp11;
>   }
> -  if (Tok.Type == TT_BinaryOperator ||
> -      (Tok.Parent->Type == TT_BinaryOperator && Tok.isNot(tok::comma)))
> +  if (Tok.is(tok::arrowstar) || Tok.Parent->is(tok::arrowstar))
> +    return false;
> +  if (Tok.Type == TT_BinaryOperator || Tok.Parent->Type == TT_BinaryOperator)
>     return true;
>   if (Tok.Parent->Type == TT_TemplateCloser && Tok.is(tok::l_paren))
>     return false;
> 
> Modified: cfe/trunk/unittests/Format/FormatTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=176252&r1=176251&r2=176252&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Feb 28 07:40:17 2013
> @@ -1713,6 +1713,7 @@ TEST_F(FormatTest, UnderstandsTemplatePa
> 
> TEST_F(FormatTest, UnderstandsBinaryOperators) {
>   verifyFormat("COMPARE(a, ==, b);");
> +  verifyFormat("(a->*f)()");
> }
> 
> TEST_F(FormatTest, UnderstandsUnaryOperators) {
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list