10 #include "clang/AST/ASTContext.h"
11 #include "clang/ASTMatchers/ASTMatchFinder.h"
19 void FloatLoopCounter::registerMatchers(MatchFinder *Finder) {
21 forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind(
"for"),
25 void FloatLoopCounter::check(
const MatchFinder::MatchResult &Result) {
26 const auto *
FS = Result.Nodes.getNodeAs<ForStmt>(
"for");
28 diag(
FS->getInc()->getExprLoc(),
"loop induction expression should not have "
29 "floating-point type");