[clang] 398cddf - [clang-format] Fix assertion that doesn't hold under fuzzing.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 02:50:53 PST 2023
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);
More information about the cfe-commits
mailing list