[cfe-commits] r172351 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp

Daniel Jasper djasper at google.com
Sun Jan 13 00:19:51 PST 2013


Author: djasper
Date: Sun Jan 13 02:19:51 2013
New Revision: 172351

URL: http://llvm.org/viewvc/llvm-project?rev=172351&view=rev
Log:
Always put a space after ",".

I am not aware of a case where that would be wrong. The specific case I
am fixing are function parameters wrapped in parenthesis (e.g. in
macros).

Before: function(a,(b));
After:  function(a, (b));

Modified:
    cfe/trunk/lib/Format/Format.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=172351&r1=172350&r2=172351&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Sun Jan 13 02:19:51 2013
@@ -1149,6 +1149,8 @@
         (Tok.is(tok::equal) || Tok.Parent->is(tok::equal)))
       return false;
 
+    if (Tok.Parent->is(tok::comma))
+      return true;
     if (Tok.Type == TT_IncludePath)
       return Tok.is(tok::less) || Tok.is(tok::string_literal);
     if (Tok.Type == TT_CtorInitializerColon || Tok.Type == TT_ObjCBlockLParen)

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=172351&r1=172350&r2=172351&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Sun Jan 13 02:19:51 2013
@@ -121,6 +121,7 @@
 TEST_F(FormatTest, FormatsNestedCall) {
   verifyFormat("Method(f1, f2(f3));");
   verifyFormat("Method(f1(f2, f3()));");
+  verifyFormat("Method(f1(f2, (f3())));");
 }
 
 //===----------------------------------------------------------------------===//





More information about the cfe-commits mailing list