r367648 - [clang-format] Fix a bug that doesn't break braces before unions for Allman
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 21:30:42 PDT 2019
Author: owenpan
Date: Thu Aug 1 21:30:42 2019
New Revision: 367648
URL: http://llvm.org/viewvc/llvm-project?rev=367648&view=rev
Log:
[clang-format] Fix a bug that doesn't break braces before unions for Allman
Differential Revision: https://reviews.llvm.org/D65631
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=367648&r1=367647&r2=367648&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Aug 1 21:30:42 2019
@@ -640,6 +640,7 @@ static FormatStyle expandPresets(const F
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;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=367648&r1=367647&r2=367648&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Aug 1 21:30:42 2019
@@ -11086,6 +11086,9 @@ TEST_F(FormatTest, AllmanBraceBreaking)
"{\n"
" int x;\n"
"};\n"
+ "union C\n"
+ "{\n"
+ "};\n"
"} // namespace a",
AllmanBraceStyle);
More information about the cfe-commits
mailing list