Skip to content

Commit 7e53392

Browse files
committed
format
1 parent 8d70f4b commit 7e53392

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7138,10 +7138,12 @@ def warn_consecutive_comparison : Warning<
71387138
"chained comparison 'X %0 Y %1 Z' does not behave the same as a mathematical expression">,
71397139
InGroup<Parentheses>, DefaultError;
71407140

7141-
def warn_comparison_in_fold_expression : Warning<
7142-
"comparison in a fold expression would evaluate to '(X %0 Y) %0 Z' "
7143-
"which does not behave the same as a mathematical expression">,
7144-
InGroup<Parentheses>, DefaultError;
7141+
def warn_comparison_in_fold_expression
7142+
: Warning<
7143+
"comparison in a fold expression would evaluate to '(X %0 Y) %0 Z' "
7144+
"which does not behave the same as a mathematical expression">,
7145+
InGroup<Parentheses>,
7146+
DefaultError;
71457147

71467148
def warn_enum_constant_in_bool_context : Warning<
71477149
"converting the enum constant to a boolean">,

clang/lib/Sema/TreeTransform.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16440,12 +16440,14 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
1644016440
} else {
1644116441
Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
1644216442
E->getOperator(), LHS, RHS);
16443-
if(!WarnedOnComparison && Result.isUsable()) {
16444-
if(auto * BO = dyn_cast<BinaryOperator>(Result.get()); BO && BO->isComparisonOp()) {
16445-
WarnedOnComparison = true;
16446-
SemaRef.Diag(BO->getBeginLoc(), diag::warn_comparison_in_fold_expression)
16447-
<< BO->getOpcodeStr();
16448-
}
16443+
if (!WarnedOnComparison && Result.isUsable()) {
16444+
if (auto *BO = dyn_cast<BinaryOperator>(Result.get());
16445+
BO && BO->isComparisonOp()) {
16446+
WarnedOnComparison = true;
16447+
SemaRef.Diag(BO->getBeginLoc(),
16448+
diag::warn_comparison_in_fold_expression)
16449+
<< BO->getOpcodeStr();
16450+
}
1644916451
}
1645016452
}
1645116453
} else

0 commit comments

Comments
 (0)