43 auto Returns = [](
bool V) {
44 return returnStmt(hasReturnValue(cxxBoolLiteral(equals(V))));
47 auto ReturnsButNotTrue =
48 returnStmt(hasReturnValue(unless(cxxBoolLiteral(equals(
true)))));
49 auto ReturnsButNotFalse =
50 returnStmt(hasReturnValue(unless(cxxBoolLiteral(equals(
false)))));
54 nextStmt(Returns(
false).bind(
"final_return")),
55 hasBody(allOf(hasDescendant(Returns(
true)),
56 unless(anyOf(hasDescendant(breakStmt()),
57 hasDescendant(gotoStmt()),
58 hasDescendant(ReturnsButNotTrue))))))
64 nextStmt(Returns(
true).bind(
"final_return")),
65 hasBody(allOf(hasDescendant(Returns(
false)),
66 unless(anyOf(hasDescendant(breakStmt()),
67 hasDescendant(gotoStmt()),
68 hasDescendant(ReturnsButNotFalse))))))
73static bool isViableLoop(
const CXXForRangeStmt &S, ASTContext &Context) {
75 ExprMutationAnalyzer Mutations(*S.getBody(), Context);
76 if (Mutations.isMutated(S.getLoopVariable()))
79 match(findAll(declRefExpr().bind(
"decl_ref")), *S.getBody(), Context);
81 return llvm::none_of(Matches, [&Mutations](
auto &DeclRef) {
83 return Mutations.isMutated(
84 DeclRef.template getNodeAs<DeclRefExpr>(
"decl_ref")->getDecl());