Skip to content

Commit 1b4f84f

Browse files
committed
Fix -Wswitch and -Wlogical-op-parentheses errors
1 parent b2b5f91 commit 1b4f84f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,17 @@ class LineJoiner {
595595
return Style.BraceWrapping.AfterClass;
596596
case TT_UnionLBrace:
597597
return Style.BraceWrapping.AfterUnion;
598+
default:
599+
return false;
598600
};
599601
};
600602

601603
// Current line begins both record and block, brace was not wrapped.
602604
if (Line->Last->isOneOf(TT_StructLBrace, TT_ClassLBrace, TT_UnionLBrace)) {
603605
auto TryMergeShortRecord = [&] {
604606
switch (Style.AllowShortRecordOnASingleLine) {
607+
case FormatStyle::SRS_Never:
608+
return false;
605609
case FormatStyle::SRS_EmptyIfAttached:
606610
case FormatStyle::SRS_Empty:
607611
return NextLine->First->is(tok::r_brace);
@@ -643,7 +647,7 @@ class LineJoiner {
643647
const bool IsEmptyBlock =
644648
Line->Last->is(tok::l_brace) && NextLine->First->is(tok::r_brace);
645649

646-
if (IsEmptyBlock && !Style.BraceWrapping.SplitEmptyRecord ||
650+
if ((IsEmptyBlock && !Style.BraceWrapping.SplitEmptyRecord) ||
647651
Style.AllowShortBlocksOnASingleLine == FormatStyle::SBS_Always) {
648652
return tryMergeSimpleBlock(I, E, Limit);
649653
}

0 commit comments

Comments
 (0)