]> granicus.if.org Git - clang/commitdiff
clang-format: Change Google style wrt. the formatting of empty messages.
authorDaniel Jasper <djasper@google.com>
Wed, 15 Aug 2018 19:07:55 +0000 (19:07 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 15 Aug 2018 19:07:55 +0000 (19:07 +0000)
Before:
  message Empty {
  }

After:
  message Empty {}

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

lib/Format/Format.cpp
unittests/Format/FormatTestProto.cpp

index 9a2da69e89b1fcb9061b59cf7f5832b299ce2da3..4a67cdeedf35692e59186e9e149e0a574731ecf3 100644 (file)
@@ -819,7 +819,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
     GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single;
     GoogleStyle.JavaScriptWrapImports = false;
   } else if (Language == FormatStyle::LK_Proto) {
-    GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
+    GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
     GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
     GoogleStyle.SpacesInContainerLiterals = false;
     GoogleStyle.Cpp11BracedListStyle = false;
index d25aeb846a97c25bf625b22580e0815e53d5f2cb..70ef2d2f13445d4b26c8a8b2cc155c8a4a5227fa 100644 (file)
@@ -397,29 +397,25 @@ TEST_F(FormatTestProto, FormatsService) {
 }
 
 TEST_F(FormatTestProto, ExtendingMessage) {
-  verifyFormat("extend .foo.Bar {\n"
-               "}");
+  verifyFormat("extend .foo.Bar {}");
 }
 
 TEST_F(FormatTestProto, FormatsImports) {
   verifyFormat("import \"a.proto\";\n"
                "import \"b.proto\";\n"
                "// comment\n"
-               "message A {\n"
-               "}");
+               "message A {}");
 
   verifyFormat("import public \"a.proto\";\n"
                "import \"b.proto\";\n"
                "// comment\n"
-               "message A {\n"
-               "}");
+               "message A {}");
 
   // Missing semicolons should not confuse clang-format.
   verifyFormat("import \"a.proto\"\n"
                "import \"b.proto\"\n"
                "// comment\n"
-               "message A {\n"
-               "}");
+               "message A {}");
 }
 
 TEST_F(FormatTestProto, KeepsLongStringLiteralsOnSameLine) {