diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index b545fa02cefb6..ee0de2c8e20da 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -511,10 +511,9 @@ class LineJoiner { ShouldMerge = !Style.BraceWrapping.AfterClass || (NextLine.First->is(tok::r_brace) && !Style.BraceWrapping.SplitEmptyRecord); - } - if (TheLine->InPPDirective || - !TheLine->First->isOneOf(tok::kw_class, tok::kw_enum, - tok::kw_struct)) { + } else if (TheLine->InPPDirective || + !TheLine->First->isOneOf(tok::kw_class, tok::kw_enum, + tok::kw_struct)) { // Try to merge a block with left brace unwrapped that wasn't yet // covered. ShouldMerge = !Style.BraceWrapping.AfterFunction ||