@@ -55,34 +55,21 @@ static bool canExprResolveTo(const Expr *Source, const Expr *Target) {
55
55
// This is matched by `IgnoreDerivedToBase(canResolveToExpr(InnerMatcher))`
56
56
// below.
57
57
const auto ConditionalOperatorM = [Target](const Expr *E) {
58
- if (const auto *OP = dyn_cast<ConditionalOperator>(E)) {
59
- if (const auto *TE = OP->getTrueExpr ()->IgnoreParens ())
60
- if (canExprResolveTo (TE, Target))
61
- 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 ())
75
- if (canExprResolveTo (FE, Target))
76
- return true ;
58
+ if (const auto *CO = dyn_cast<AbstractConditionalOperator>(E)) {
59
+ const auto *TE = CO->getTrueExpr ()->IgnoreParens ();
60
+ if (TE && canExprResolveTo (TE, Target))
61
+ return true ;
62
+ const auto *FE = CO->getFalseExpr ()->IgnoreParens ();
63
+ if (FE && canExprResolveTo (FE, Target))
64
+ return true ;
77
65
}
78
66
return false ;
79
67
};
80
68
81
69
const Expr *SourceExprP = Source->IgnoreParens ();
82
70
return IgnoreDerivedToBase (SourceExprP,
83
71
[&](const Expr *E) {
84
- return E == Target || ConditionalOperatorM (E) ||
85
- ElvisOperator (E);
72
+ return E == Target || ConditionalOperatorM (E);
86
73
}) ||
87
74
EvalCommaExpr (SourceExprP, [&](const Expr *E) {
88
75
return IgnoreDerivedToBase (
0 commit comments