diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -423,7 +423,7 @@ State.Stack.back().BreakBeforeParameter && Current.CanBreakBefore) return true; - if (State.Column <= NewLineColumn) + if (!State.Line->First->is(tok::kw_enum) && State.Column <= NewLineColumn) return false; if (Style.AlwaysBreakBeforeMultilineStrings && 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 @@ -1929,6 +1929,24 @@ " TWO\n" "};\n" "int i;"); + + FormatStyle EightIndent = getLLVMStyle(); + EightIndent.IndentWidth = 8; + verifyFormat("enum {\n" + " VOID,\n" + " CHAR,\n" + " SHORT,\n" + " INT,\n" + " LONG,\n" + " SIGNED,\n" + " UNSIGNED,\n" + " BOOL,\n" + " FLOAT,\n" + " DOUBLE,\n" + " COMPLEX\n" + "};", + EightIndent); + // Not enums. verifyFormat("enum X f() {\n" " a();\n"