[clang] 351f94d - [clang][NFC] resolve redundant predicates (#79701)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 7 21:05:57 PST 2024
Author: Rageking8
Date: 2024-02-08T06:05:53+01:00
New Revision: 351f94d981f363909ae6e76ed57cd0a75c3f5688
URL: https://github.com/llvm/llvm-project/commit/351f94d981f363909ae6e76ed57cd0a75c3f5688
DIFF: https://github.com/llvm/llvm-project/commit/351f94d981f363909ae6e76ed57cd0a75c3f5688.diff
LOG: [clang][NFC] resolve redundant predicates (#79701)
Fixes #79686
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b071a02ca3713f..c775ff207ba837 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -17183,7 +17183,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
// evaluates to true.
bool EvalResult = false;
bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult);
- bool ShouldVisitRHS = !EvalOK || (EvalOK && !EvalResult);
+ bool ShouldVisitRHS = !EvalOK || !EvalResult;
if (ShouldVisitRHS) {
Region = RHSRegion;
Visit(BO->getRHS());
@@ -17215,7 +17215,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
// [...] the second operand is not evaluated if the first operand is false.
bool EvalResult = false;
bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult);
- bool ShouldVisitRHS = !EvalOK || (EvalOK && EvalResult);
+ bool ShouldVisitRHS = !EvalOK || EvalResult;
if (ShouldVisitRHS) {
Region = RHSRegion;
Visit(BO->getRHS());
@@ -17266,8 +17266,8 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
// evaluated. [...]
bool EvalResult = false;
bool EvalOK = Eval.evaluate(CO->getCond(), EvalResult);
- bool ShouldVisitTrueExpr = !EvalOK || (EvalOK && EvalResult);
- bool ShouldVisitFalseExpr = !EvalOK || (EvalOK && !EvalResult);
+ bool ShouldVisitTrueExpr = !EvalOK || EvalResult;
+ bool ShouldVisitFalseExpr = !EvalOK || !EvalResult;
if (ShouldVisitTrueExpr) {
Region = TrueRegion;
Visit(CO->getTrueExpr());
More information about the cfe-commits
mailing list