================
@@ -610,9 +619,10 @@ void NarrowingConversionsCheck::handleBinaryOperator(const
ASTContext &Context,
void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *Op = Result.Nodes.getNodeAs<BinaryOperator>("binary_op"))
- return handleBinaryOperator(*Result.Context, *Op);
- if (const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast"))
- return handleImplicitCast(*Result.Context, *Cast);
- llvm_unreachable("must be binary operator or cast expression");
+ handleBinaryOperator(*Result.Context, *Op);
+ else if (const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast"))
+ handleImplicitCast(*Result.Context, *Cast);
+ else
+ llvm_unreachable("must be binary operator or cast expression");
----------------
localspook wrote:
That would require adding `return;` in the previous branch, otherwise it would
fall through into the `llvm_unreachable`
https://github.com/llvm/llvm-project/pull/151356
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits