Should that have been an "else if" and not just an "if" otherwise clang-format 
should be applied. 

-----Original Message-----
From: cfe-commits <cfe-commits-boun...@lists.llvm.org> On Behalf Of Manuel 
Klimek via cfe-commits
Sent: Monday, February 27, 2023 2:51 AM
To: cfe-commits@lists.llvm.org
Subject: [clang] 398cddf - [clang-format] Fix assertion that doesn't hold under 
fuzzing.


Author: Manuel Klimek
Date: 2023-02-27T10:50:42Z
New Revision: 398cddf6acecfb12b5997c2d639ee3cf31b787ad

URL: 
https://github.com/llvm/llvm-project/commit/398cddf6acecfb12b5997c2d639ee3cf31b787ad
DIFF: 
https://github.com/llvm/llvm-project/commit/398cddf6acecfb12b5997c2d639ee3cf31b787ad.diff

LOG: [clang-format] Fix assertion that doesn't hold under fuzzing.

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineFormatter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index b0314d6cfa75f..c789f2907dac9 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -511,12 +511,11 @@ class LineJoiner {
         ShouldMerge = !Style.BraceWrapping.AfterClass ||
                       (NextLine.First->is(tok::r_brace) &&
                        !Style.BraceWrapping.SplitEmptyRecord);
-      } 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.
-        assert(TheLine->InPPDirective ||
-               !TheLine->First->isOneOf(tok::kw_class, tok::kw_enum,
-                                        tok::kw_struct));
         ShouldMerge = !Style.BraceWrapping.AfterFunction ||
                       (NextLine.First->is(tok::r_brace) &&
                        !Style.BraceWrapping.SplitEmptyFunction);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to