r207538 - clang-format: Don't bin-pack text-proto-formatted options.

Daniel Jasper djasper at google.com
Tue Apr 29 08:54:14 PDT 2014


Author: djasper
Date: Tue Apr 29 10:54:14 2014
New Revision: 207538

URL: http://llvm.org/viewvc/llvm-project?rev=207538&view=rev
Log:
clang-format: Don't bin-pack text-proto-formatted options.

Before:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
                              bbbbbbb: BBBB, bbbb: BBB}];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
                              bbbbbbb: BBBB,
                              bbbb: BBB}];

Modified:
    cfe/trunk/lib/Format/ContinuationIndenter.cpp
    cfe/trunk/unittests/Format/FormatTestProto.cpp

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=207538&r1=207537&r2=207538&view=diff
==============================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Tue Apr 29 10:54:14 2014
@@ -725,6 +725,7 @@ unsigned ContinuationIndenter::moveState
       AvoidBinPacking = Current.BlockKind == BK_Block ||
                         Current.Type == TT_ArrayInitializerLSquare ||
                         Current.Type == TT_DictLiteral ||
+                        Style.Language == FormatStyle::LK_Proto ||
                         !Style.BinPackParameters ||
                         (NextNoComment &&
                          NextNoComment->Type == TT_DesignatedInitializerPeriod);

Modified: cfe/trunk/unittests/Format/FormatTestProto.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestProto.cpp?rev=207538&r1=207537&r2=207538&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestProto.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestProto.cpp Tue Apr 29 10:54:14 2014
@@ -88,6 +88,10 @@ TEST_F(FormatTestProto, MessageFieldAttr
   verifyFormat("repeated double value = 1\n"
                "    [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA\n"
                "                            bbbbbbbbbbbbbbbb: BBBBBBBBBB}];");
+  verifyFormat("repeated double value = 1\n"
+               "    [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,\n"
+               "                            bbbbbbb: BBBB,\n"
+               "                            bbbb: BBB}];");
 }
 
 TEST_F(FormatTestProto, FormatsOptions) {





More information about the cfe-commits mailing list