Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -750,6 +750,7 @@ } else if (Language == FormatStyle::LK_Proto) { GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; GoogleStyle.SpacesInContainerLiterals = false; + GoogleStyle.Cpp11BracedListStyle = false; } else if (Language == FormatStyle::LK_ObjC) { GoogleStyle.ColumnLimit = 100; } Index: unittests/Format/FormatTestProto.cpp =================================================================== --- unittests/Format/FormatTestProto.cpp +++ unittests/Format/FormatTestProto.cpp @@ -97,7 +97,7 @@ " TYPE_B = 2;\n" "};"); verifyFormat("enum Type {\n" - " UNKNOWN = 0 [(some_options) = {a: aa, b: bb}];\n" + " UNKNOWN = 0 [(some_options) = { a: aa, b: bb }];\n" "};"); verifyFormat("enum Type {\n" " UNKNOWN = 0 [(some_options) = {\n" @@ -121,7 +121,7 @@ verifyFormat("optional LongMessageType long_proto_field = 1\n" " [default = REALLY_REALLY_LONG_CONSTANT_VALUE];"); verifyFormat("repeated double value = 1\n" - " [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa: AAAAAAAA}];"); + " [(aaaaaaa.aaaaaaaaa) = { aaaaaaaaaaaaaaaaa: AAAAAAAA }];"); verifyFormat("repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {\n" " aaaaaaaaaaaaaaaa: AAAAAAAAAA,\n" " bbbbbbbbbbbbbbbb: BBBBBBBBBB\n" @@ -183,27 +183,27 @@ " field_a: OK\n" " field_b: \"OK\"\n" " field_c: \"OK\"\n" - " msg_field: {field_d: 123}\n" + " msg_field: { field_d: 123 }\n" "};"); verifyFormat("option (MyProto.options) = {\n" " field_a: OK\n" " field_b: \"OK\"\n" " field_c: \"OK\"\n" - " msg_field: {field_d: 123 field_e: OK}\n" + " msg_field: { field_d: 123 field_e: OK }\n" "};"); verifyFormat("option (MyProto.options) = {\n" " field_a: OK // Comment\n" " field_b: \"OK\"\n" " field_c: \"OK\"\n" - " msg_field: {field_d: 123}\n" + " msg_field: { field_d: 123 }\n" "};"); verifyFormat("option (MyProto.options) = {\n" " field_c: \"OK\"\n" - " msg_field {field_d: 123}\n" + " msg_field { field_d: 123 }\n" "};"); verifyFormat("option (MyProto.options) = {\n" " field_a: OK\n" - " field_b {field_c: OK}\n" + " field_b { field_c: OK }\n" " field_d: OKOKOK\n" " field_e: OK\n" "}"); @@ -247,7 +247,7 @@ verifyFormat("option (MyProto.options) = <\n" " field_a: \"OK\"\n" - " msg_field: {field_b: OK}\n" + " msg_field: { field_b: OK }\n" " field_g: OK\n" " field_g: OK\n" " field_g: OK\n" @@ -359,7 +359,7 @@ verifyFormat("option (MyProto.options) = <\n" " data1 \n" - " data2 {key2: value2}\n" + " data2 { key2: value2 }\n" ">;"); verifyFormat("option (MyProto.options) = <\n" @@ -372,7 +372,7 @@ " app_id: 'com.javax.swing.salsa.latino'\n" " head_id: 1\n" " headheadheadheadheadhead_id: 1\n" - " product_data {product {1}}\n" + " product_data { product { 1 } }\n" "};"); } Index: unittests/Format/FormatTestRawStrings.cpp =================================================================== --- unittests/Format/FormatTestRawStrings.cpp +++ unittests/Format/FormatTestRawStrings.cpp @@ -186,7 +186,7 @@ R"test(P p = TP(R"pb(item_1:1 item_2:2)pb");)test", getRawStringPbStyleWithColumns(40))); expect_eq( - R"test(P p = TP(R"pb(item_1 <1> item_2: {2})pb");)test", + R"test(P p = TP(R"pb(item_1 <1> item_2: { 2 })pb");)test", format( R"test(P p = TP(R"pb(item_1<1> item_2:{2})pb");)test", getRawStringPbStyleWithColumns(40))); @@ -246,9 +246,9 @@ expect_eq(R"test( P p = TPPPPPPPPPPPPPPP( R"pb(item_1 <1>, - item_2: {2}, + item_2: { 2 }, item_3: <3>, - item_4: {4})pb");)test", + item_4: { 4 })pb");)test", format(R"test( P p = TPPPPPPPPPPPPPPP(R"pb(item_1<1>, item_2: {2}, item_3: <3>, item_4:{4})pb");)test", getRawStringPbStyleWithColumns(40))); @@ -295,7 +295,7 @@ TEST_F(FormatTestRawStrings, FormatsRawStringArguments) { expect_eq(R"test( -P p = TP(R"pb(key {1})pb", param_2);)test", +P p = TP(R"pb(key { 1 })pb", param_2);)test", format(R"test( P p = TP(R"pb(key{1})pb",param_2);)test", getRawStringPbStyleWithColumns(40))); @@ -308,9 +308,9 @@ getRawStringPbStyleWithColumns(40))); expect_eq(R"test( -P p = - TP(R"pb(item: {i: 1, s: 's'} - item: {i: 2, s: 't'})pb");)test", +P p = TP( + R"pb(item: { i: 1, s: 's' } + item: { i: 2, s: 't' })pb");)test", format(R"test( P p = TP(R"pb(item: {i: 1, s: 's'} item: {i: 2, s: 't'})pb");)test", getRawStringPbStyleWithColumns(40))); Index: unittests/Format/FormatTestTextProto.cpp =================================================================== --- unittests/Format/FormatTestTextProto.cpp +++ unittests/Format/FormatTestTextProto.cpp @@ -49,9 +49,9 @@ TEST_F(FormatTestTextProto, SupportsMessageFields) { verifyFormat("msg_field: {}"); - verifyFormat("msg_field: {field_a: A}"); + verifyFormat("msg_field: { field_a: A }"); - verifyFormat("msg_field: {field_a: \"OK\" field_b: 123}"); + verifyFormat("msg_field: { field_a: \"OK\" field_b: 123 }"); verifyFormat("msg_field: {\n" " field_a: 1\n" @@ -63,9 +63,9 @@ verifyFormat("msg_field {}"); - verifyFormat("msg_field {field_a: A}"); + verifyFormat("msg_field { field_a: A }"); - verifyFormat("msg_field {field_a: \"OK\" field_b: 123}"); + verifyFormat("msg_field { field_a: \"OK\" field_b: 123 }"); verifyFormat("msg_field {\n" " field_a: 1\n" @@ -78,11 +78,11 @@ " field_h: 1234.567e-89\n" "}"); - verifyFormat("msg_field: {msg_field {field_a: 1}}"); + verifyFormat("msg_field: { msg_field { field_a: 1 } }"); verifyFormat("id: \"ala.bala\"\n" - "item {type: ITEM_A rank: 1 score: 90.0}\n" - "item {type: ITEM_B rank: 2 score: 70.5}\n" + "item { type: ITEM_A rank: 1 score: 90.0 }\n" + "item { type: ITEM_B rank: 2 score: 70.5 }\n" "item {\n" " type: ITEM_A\n" " rank: 3\n" @@ -102,24 +102,24 @@ verifyFormat("field_a: OK\n" "field_b: \"OK\"\n" "field_c: \"OK\"\n" - "msg_field: {field_d: 123}\n" + "msg_field: { field_d: 123 }\n" "field_e: OK\n" "field_f: OK"); verifyFormat("field_a: OK\n" "field_b: \"OK\"\n" "field_c: \"OK\"\n" - "msg_field: {field_d: 123 field_e: OK}"); + "msg_field: { field_d: 123 field_e: OK }"); verifyFormat("a: {\n" " field_a: OK\n" - " field_b {field_c: OK}\n" + " field_b { field_c: OK }\n" " field_d: OKOKOK\n" " field_e: OK\n" "}"); verifyFormat("field_a: OK,\n" - "field_b {field_c: OK},\n" + "field_b { field_c: OK },\n" "field_d: OKOKOK,\n" "field_e: OK"); } @@ -150,10 +150,10 @@ verifyFormat("msg_field: >>"); verifyFormat("msg_field "); verifyFormat("msg_field , field_c: OK>"); - verifyFormat("msg_field >"); + verifyFormat("msg_field >"); verifyFormat("msg_field: "); verifyFormat("msg_field: , field_c: OK>"); - verifyFormat("msg_field: >"); + verifyFormat("msg_field: >"); verifyFormat("field_a: \"OK\", msg_field: , field_c: {}"); verifyFormat("field_a , msg_field: , field_c <>"); verifyFormat("field_a msg_field: field_c <>"); @@ -200,7 +200,7 @@ verifyFormat("msg_field: <\n" " field_a: \"OK\"\n" - " msg_field: {field_b: OK}\n" + " msg_field: { field_b: OK }\n" " field_g: OK\n" " field_g: OK\n" " field_g: OK\n" @@ -226,7 +226,7 @@ " field_b2: ok,\n" " field_b3: <\n" " field_x {} // Comment\n" - " field_y: {field_z: 1}\n" + " field_y: { field_z: 1 }\n" " field_w: ok\n" " >\n" " field {\n" @@ -258,7 +258,7 @@ verifyFormat("app_id: 'com.javax.swing.salsa.latino'\n" "head_id: 1\n" "data \n" - "data {key: value}"); + "data { key: value }"); verifyFormat("app {\n" " app_id: 'com.javax.swing.salsa.latino'\n" @@ -274,11 +274,11 @@ verifyFormat("app_id: 'com.javax.swing.salsa.latino'\n" "headheadheadheadheadhead_id: 1\n" - "product_data {product {1}}"); + "product_data { product { 1 } }"); verifyFormat("app_id: 'com.javax.swing.salsa.latino'\n" "headheadheadheadheadhead_id: 1\n" - "product_data "); + "product_data "); verifyFormat("app_id: 'com.javax.swing.salsa.latino'\n" "headheadheadheadheadhead_id: 1\n" @@ -287,11 +287,11 @@ verifyFormat("app <\n" " app_id: 'com.javax.swing.salsa.latino'\n" " headheadheadheadheadhead_id: 1\n" - " product_data \n" + " product_data \n" ">"); verifyFormat("dcccwrnfioeruvginerurneitinfo {\n" - " exte3nsionrnfvui {key: value}\n" + " exte3nsionrnfvui { key: value }\n" "}"); }