From: Daniel Jasper Date: Wed, 15 Aug 2018 19:07:55 +0000 (+0000) Subject: clang-format: Change Google style wrt. the formatting of empty messages. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42c483011b56fbd5d5aad7bad53135190b2d693a;p=clang clang-format: Change Google style wrt. the formatting of empty messages. Before: message Empty { } After: message Empty {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339803 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 9a2da69e89..4a67cdeedf 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -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; diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index d25aeb846a..70ef2d2f13 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/unittests/Format/FormatTestProto.cpp @@ -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) {