]> granicus.if.org Git - clang/commitdiff
Always put a space after ",".
authorDaniel Jasper <djasper@google.com>
Sun, 13 Jan 2013 08:19:51 +0000 (08:19 +0000)
committerDaniel Jasper <djasper@google.com>
Sun, 13 Jan 2013 08:19:51 +0000 (08:19 +0000)
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));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172351 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp
unittests/Format/FormatTest.cpp

index 64a6224b0b9f4cad40d10c1452fc0aca28844dc0..727e85fa4f9dd84e6085f0b6c879ed7b75a56e03 100644 (file)
@@ -1149,6 +1149,8 @@ private:
         (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)
index 984732571e07a96dc5b321eaa97703319c8b3d6f..a46c9b685bcb0fe9c8ffd9bb21a873aa5ef1e6c9 100644 (file)
@@ -121,6 +121,7 @@ TEST_F(FormatTest, FormatsNestedBlockStatements) {
 TEST_F(FormatTest, FormatsNestedCall) {
   verifyFormat("Method(f1, f2(f3));");
   verifyFormat("Method(f1(f2, f3()));");
+  verifyFormat("Method(f1(f2, (f3())));");
 }
 
 //===----------------------------------------------------------------------===//