20 forStmt(hasIncrement(forEachDescendant(
21 declRefExpr(hasType(realFloatingPointType()),
22 to(varDecl().bind(
"var")))
24 hasCondition(forEachDescendant(
25 declRefExpr(hasType(realFloatingPointType()),
26 to(varDecl(equalsBoundNode(
"var"))))
33 const auto *FS = Result.Nodes.getNodeAs<ForStmt>(
"for");
34 assert(FS &&
"FS should not be null");
36 diag(FS->getInc()->getBeginLoc(),
"loop induction expression should not have "
37 "floating-point type")
38 << Result.Nodes.getNodeAs<DeclRefExpr>(
"inc")->getSourceRange()
39 << Result.Nodes.getNodeAs<DeclRefExpr>(
"cond")->getSourceRange();
41 if (!FS->getInc()->getType()->isRealFloatingType())
42 if (
const auto *V = Result.Nodes.getNodeAs<VarDecl>(
"var"))
43 diag(V->getBeginLoc(),
"floating-point type loop induction variable",