From: Owen Pan Date: Fri, 2 Aug 2019 04:30:42 +0000 (+0000) Subject: [clang-format] Fix a bug that doesn't break braces before unions for Allman X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9131e925fd6b5010a9e797342a09141306183ed6;p=platform%2Fupstream%2Fllvm.git [clang-format] Fix a bug that doesn't break braces before unions for Allman Differential Revision: https://reviews.llvm.org/D65631 llvm-svn: 367648 --- diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index c699216..589cf96 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -640,6 +640,7 @@ static FormatStyle expandPresets(const FormatStyle &Style) { Expanded.BraceWrapping.AfterNamespace = true; Expanded.BraceWrapping.AfterObjCDeclaration = true; Expanded.BraceWrapping.AfterStruct = true; + Expanded.BraceWrapping.AfterUnion = true; Expanded.BraceWrapping.AfterExternBlock = true; Expanded.BraceWrapping.BeforeCatch = true; Expanded.BraceWrapping.BeforeElse = true; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 53a4628..528ad4b 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -11086,6 +11086,9 @@ TEST_F(FormatTest, AllmanBraceBreaking) { "{\n" " int x;\n" "};\n" + "union C\n" + "{\n" + "};\n" "} // namespace a", AllmanBraceStyle);