r339803 - clang-format: Change Google style wrt. the formatting of empty messages.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 15 12:07:55 PDT 2018


Author: djasper
Date: Wed Aug 15 12:07:55 2018
New Revision: 339803

URL: http://llvm.org/viewvc/llvm-project?rev=339803&view=rev
Log:
clang-format: Change Google style wrt. the formatting of empty messages.

Before:
  message Empty {
  }

After:
  message Empty {}

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=339803&r1=339802&r2=339803&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Aug 15 12:07:55 2018
@@ -819,7 +819,7 @@ FormatStyle getGoogleStyle(FormatStyle::
     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;

Modified: cfe/trunk/unittests/Format/FormatTestProto.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestProto.cpp?rev=339803&r1=339802&r2=339803&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestProto.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestProto.cpp Wed Aug 15 12:07:55 2018
@@ -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) {




More information about the cfe-commits mailing list