Skip to content

Commit 9f72df7

Browse files
committed
Fixing a formatting mistake; NFC
There was a brace that was hanging out in the middle of nowhere, this fixes that issue.
1 parent 43ad521 commit 9f72df7

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13890,44 +13890,44 @@ void Sema::diagnoseLogicalInsteadOfBitwise(Expr *Op1, Expr *Op2,
1389013890
Op2->getType()->isIntegerType() && !Op2->isValueDependent() &&
1389113891
// Don't warn in macros or template instantiations.
1389213892
!Loc.isMacroID() && !inTemplateInstantiation() &&
13893-
!Op2->getExprLoc().isMacroID() &&
13894-
!Op1->getExprLoc().isMacroID()) {
13893+
!Op2->getExprLoc().isMacroID() && !Op1->getExprLoc().isMacroID()) {
1389513894
bool IsOp1InMacro = Op1->getExprLoc().isMacroID();
1389613895
bool IsOp2InMacro = Op2->getExprLoc().isMacroID();
1389713896

1389813897
// Exclude the specific expression from triggering the warning.
13899-
if (!(IsOp1InMacro && IsOp2InMacro && Op1->getSourceRange() == Op2->getSourceRange())) {
13900-
// If the RHS can be constant folded, and if it constant folds to something
13901-
// that isn't 0 or 1 (which indicate a potential logical operation that
13902-
// happened to fold to true/false) then warn.
13903-
// Parens on the RHS are ignored.
13904-
// If the RHS can be constant folded, and if it constant folds to something
13905-
// that isn't 0 or 1 (which indicate a potential logical operation that
13906-
// happened to fold to true/false) then warn.
13907-
// Parens on the RHS are ignored.
13908-
Expr::EvalResult EVResult;
13909-
if (Op2->EvaluateAsInt(EVResult, Context)) {
13910-
llvm::APSInt Result = EVResult.Val.getInt();
13911-
if ((getLangOpts().Bool && !Op2->getType()->isBooleanType() &&
13912-
!Op2->getExprLoc().isMacroID()) ||
13913-
(Result != 0 && Result != 1)) {
13914-
Diag(Loc, diag::warn_logical_instead_of_bitwise)
13915-
<< Op2->getSourceRange() << (Opc == BO_LAnd ? "&&" : "||");
13916-
// Suggest replacing the logical operator with the bitwise version
13917-
Diag(Loc, diag::note_logical_instead_of_bitwise_change_operator)
13918-
<< (Opc == BO_LAnd ? "&" : "|")
13919-
<< FixItHint::CreateReplacement(
13920-
SourceRange(Loc, getLocForEndOfToken(Loc)),
13921-
Opc == BO_LAnd ? "&" : "|");
13922-
if (Opc == BO_LAnd)
13923-
// Suggest replacing "Foo() && kNonZero" with "Foo()"
13924-
Diag(Loc, diag::note_logical_instead_of_bitwise_remove_constant)
13925-
<< FixItHint::CreateRemoval(SourceRange(
13926-
getLocForEndOfToken(Op1->getEndLoc()), Op2->getEndLoc()));
13898+
if (!(IsOp1InMacro && IsOp2InMacro &&
13899+
Op1->getSourceRange() == Op2->getSourceRange())) {
13900+
// If the RHS can be constant folded, and if it constant folds to
13901+
// something that isn't 0 or 1 (which indicate a potential logical
13902+
// operation that happened to fold to true/false) then warn. Parens on the
13903+
// RHS are ignored. If the RHS can be constant folded, and if it constant
13904+
// folds to something that isn't 0 or 1 (which indicate a potential
13905+
// logical operation that happened to fold to true/false) then warn.
13906+
// Parens on the RHS are ignored.
13907+
Expr::EvalResult EVResult;
13908+
if (Op2->EvaluateAsInt(EVResult, Context)) {
13909+
llvm::APSInt Result = EVResult.Val.getInt();
13910+
if ((getLangOpts().Bool && !Op2->getType()->isBooleanType() &&
13911+
!Op2->getExprLoc().isMacroID()) ||
13912+
(Result != 0 && Result != 1)) {
13913+
Diag(Loc, diag::warn_logical_instead_of_bitwise)
13914+
<< Op2->getSourceRange() << (Opc == BO_LAnd ? "&&" : "||");
13915+
// Suggest replacing the logical operator with the bitwise version
13916+
Diag(Loc, diag::note_logical_instead_of_bitwise_change_operator)
13917+
<< (Opc == BO_LAnd ? "&" : "|")
13918+
<< FixItHint::CreateReplacement(
13919+
SourceRange(Loc, getLocForEndOfToken(Loc)),
13920+
Opc == BO_LAnd ? "&" : "|");
13921+
if (Opc == BO_LAnd)
13922+
// Suggest replacing "Foo() && kNonZero" with "Foo()"
13923+
Diag(Loc, diag::note_logical_instead_of_bitwise_remove_constant)
13924+
<< FixItHint::CreateRemoval(
13925+
SourceRange(getLocForEndOfToken(Op1->getEndLoc()),
13926+
Op2->getEndLoc()));
13927+
}
1392713928
}
1392813929
}
1392913930
}
13930-
}
1393113931
}
1393213932

1393313933
// C99 6.5.[13,14]

0 commit comments

Comments
 (0)