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

Daniel Jasper djasper at google.com
Tue Jan 8 12:03:18 PST 2013


Author: djasper
Date: Tue Jan  8 14:03:18 2013
New Revision: 171890

URL: http://llvm.org/viewvc/llvm-project?rev=171890&view=rev
Log:
Don't break after unary operators.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *
                                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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=171890&r1=171889&r2=171890&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Jan  8 14:03:18 2013
@@ -1049,9 +1049,8 @@
     if (Left.ClosesTemplateDeclaration)
       return true;
     if (Left.Type == TT_PointerOrReference || Left.Type == TT_TemplateCloser ||
-        Right.Type == TT_ConditionalExpr) {
+        Left.Type == TT_UnaryOperator || Right.Type == TT_ConditionalExpr)
       return false;
-    }
     if (Left.is(tok::equal) && CurrentLineType == LT_VirtualFunctionDecl)
       return false;
 

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171890&r1=171889&r2=171890&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Jan  8 14:03:18 2013
@@ -958,7 +958,6 @@
 
   verifyFormat("InvalidRegions[*R] = 0;");
 
-  // FIXME: Is this desired for LLVM? Fix if not.
   verifyFormat("A<int *> a;");
   verifyFormat("A<int **> a;");
   verifyFormat("A<int *, int *> a;");
@@ -967,6 +966,10 @@
   verifyFormat("Type *A = (Type *) P;");
   verifyFormat("Type *A = (vector<Type *, int *>) P;");
 
+  verifyFormat(
+      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+      "    aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+
   verifyGoogleFormat("int main(int argc, char** argv) {\n}");
   verifyGoogleFormat("A<int*> a;");
   verifyGoogleFormat("A<int**> a;");





More information about the cfe-commits mailing list