[PATCH] D65631: [clang-format] Fix a bug that doesn't break braces before unions for Allman

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 21:20:39 PDT 2019


owenpan created this revision.
owenpan added a project: clang.
Herald added a subscriber: cfe-commits.

Fixes PR42155


Repository:
  rC Clang

https://reviews.llvm.org/D65631

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -11086,6 +11086,9 @@
                "{\n"
                "  int x;\n"
                "};\n"
+               "union C\n"
+               "{\n"
+               "};\n"
                "} // namespace a",
                AllmanBraceStyle);
 
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -640,6 +640,7 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65631.212964.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190802/4826bafb/attachment.bin>


More information about the cfe-commits mailing list