11 #include "clang/AST/ASTContext.h"
12 #include "clang/ASTMatchers/ASTMatchFinder.h"
14 using namespace clang::ast_matchers;
20 void FloatLoopCounter::registerMatchers(MatchFinder *
Finder) {
22 forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind(
"for"),
26 void FloatLoopCounter::check(
const MatchFinder::MatchResult &Result) {
27 const auto *FS = Result.Nodes.getNodeAs<ForStmt>(
"for");
29 diag(FS->getInc()->getExprLoc(),
"loop induction expression should not have "
30 "floating-point type");
std::unique_ptr< ast_matchers::MatchFinder > Finder