[PATCH] D93938: [clang-format] Fixed AfterEnum handling

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 15 01:37:23 PDT 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3690-3691
+    return (isAllowedByAfterEnum && isAllowedByShortEnums) ||
            (Line.startsWith(tok::kw_class) && Style.BraceWrapping.AfterClass) ||
            (Line.startsWith(tok::kw_struct) && Style.BraceWrapping.AfterStruct);
+  }
----------------
Maybe move that check to the top and return early (without running through the loop and strlen).


================
Comment at: clang/unittests/Format/FormatTest.cpp:13319
   AllmanBraceStyle.BreakBeforeBraces = FormatStyle::BS_Allman;
+  AllmanBraceStyle.AllowShortEnumsOnASingleLine = false;
 
----------------
curdeius wrote:
> That shouldn't be necessary here.
Is it useful to test once with false and once with true?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938



More information about the cfe-commits mailing list