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: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0e06d7ab5de059dbfb456d13d21de56811b071b;p=clang [clang-format] Fix a bug that doesn't break braces before unions for Allman Differential Revision: https://reviews.llvm.org/D65631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index c699216195..589cf96b20 100644 --- a/lib/Format/Format.cpp +++ b/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/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 53a46283e1..528ad4b78c 100644 --- a/unittests/Format/FormatTest.cpp +++ b/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);