[PATCH] D93938: Fixed AfterEnum handling

Ally Tiritoglu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 30 00:59:22 PST 2020


atirit created this revision.
atirit requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93938

Files:
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -694,6 +694,8 @@
     return Style.BraceWrapping.AfterUnion;
   if (InitialToken.is(tok::kw_struct))
     return Style.BraceWrapping.AfterStruct;
+  if (InitialToken.is(tok::kw_enum))
+    return Style.BraceWrapping.AfterEnum;
   return false;
 }
 
@@ -1299,7 +1301,7 @@
       if (!parseEnum())
         break;
       // This only applies for C++.
-      if (!Style.isCpp()) {
+      if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
         addUnwrappedLine();
         return;
       }
@@ -2482,8 +2484,6 @@
     return true;
   }
 
-  if (!Style.AllowShortEnumsOnASingleLine)
-    addUnwrappedLine();
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93938.314085.patch
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201230/a71bad24/attachment.bin>


More information about the cfe-commits mailing list