Skip to content

Commit d5fd3c5

Browse files
committed
[mutation analyzer][NFC] combine ConditionalOperator BinaryConditionalOperator
1 parent b1a48af commit d5fd3c5

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

clang/lib/Analysis/ExprMutationAnalyzer.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,11 @@ static bool canExprResolveTo(const Expr *Source, const Expr *Target) {
5555
// This is matched by `IgnoreDerivedToBase(canResolveToExpr(InnerMatcher))`
5656
// below.
5757
const auto ConditionalOperatorM = [Target](const Expr *E) {
58-
if (const auto *OP = dyn_cast<ConditionalOperator>(E)) {
59-
if (const auto *TE = OP->getTrueExpr()->IgnoreParens())
58+
if (const auto *CO = dyn_cast<AbstractConditionalOperator>(E)) {
59+
if (const auto *TE = CO->getTrueExpr()->IgnoreParens())
6060
if (canExprResolveTo(TE, Target))
6161
return true;
62-
if (const auto *FE = OP->getFalseExpr()->IgnoreParens())
63-
if (canExprResolveTo(FE, Target))
64-
return true;
65-
}
66-
return false;
67-
};
68-
69-
const auto ElvisOperator = [Target](const Expr *E) {
70-
if (const auto *OP = dyn_cast<BinaryConditionalOperator>(E)) {
71-
if (const auto *TE = OP->getTrueExpr()->IgnoreParens())
72-
if (canExprResolveTo(TE, Target))
73-
return true;
74-
if (const auto *FE = OP->getFalseExpr()->IgnoreParens())
62+
if (const auto *FE = CO->getFalseExpr()->IgnoreParens())
7563
if (canExprResolveTo(FE, Target))
7664
return true;
7765
}
@@ -81,8 +69,7 @@ static bool canExprResolveTo(const Expr *Source, const Expr *Target) {
8169
const Expr *SourceExprP = Source->IgnoreParens();
8270
return IgnoreDerivedToBase(SourceExprP,
8371
[&](const Expr *E) {
84-
return E == Target || ConditionalOperatorM(E) ||
85-
ElvisOperator(E);
72+
return E == Target || ConditionalOperatorM(E);
8673
}) ||
8774
EvalCommaExpr(SourceExprP, [&](const Expr *E) {
8875
return IgnoreDerivedToBase(

0 commit comments

Comments
 (0)