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");
35 diag(FS->getInc()->getBeginLoc(),
"loop induction expression should not have "
36 "floating-point type")
37 << Result.Nodes.getNodeAs<DeclRefExpr>(
"inc")->getSourceRange()
38 << Result.Nodes.getNodeAs<DeclRefExpr>(
"cond")->getSourceRange();
40 if (!FS->getInc()->getType()->isRealFloatingType())
41 if (
const auto *V = Result.Nodes.getNodeAs<VarDecl>(
"var"))
42 diag(V->getBeginLoc(),
"floating-point type loop induction variable",