[clang] 9e9e096 - [clang-format] Fix dropped 'else'.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 05:00:20 PDT 2023


Author: Manuel Klimek
Date: 2023-04-21T11:59:45Z
New Revision: 9e9e096ae95b9a41bf855cda01963a65313e9560

URL: https://github.com/llvm/llvm-project/commit/9e9e096ae95b9a41bf855cda01963a65313e9560
DIFF: https://github.com/llvm/llvm-project/commit/9e9e096ae95b9a41bf855cda01963a65313e9560.diff

LOG: [clang-format] Fix dropped 'else'.

'else' was dropped accidentally in 398cddf6acec.

Patch by Jared Grubb.

Differential revision: https://reviews.llvm.org/D146310

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineFormatter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index b545fa02cefb..ee0de2c8e20d 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 ||


        


More information about the cfe-commits mailing list