diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1301,7 +1301,7 @@ if (!parseEnum()) break; // This only applies for C++. - if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) { + if (!Style.isCpp()) { addUnwrappedLine(); return; } @@ -2484,6 +2484,9 @@ return true; } + if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum) + addUnwrappedLine(); + // Parse enum body. nextToken(); if (!Style.AllowShortEnumsOnASingleLine) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1344,8 +1344,7 @@ Style.AllowShortEnumsOnASingleLine = true; verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style); Style.AllowShortEnumsOnASingleLine = false; - verifyFormat("enum\n" - "{\n" + verifyFormat("enum {\n" " A,\n" " B,\n" " C\n"