10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
19 forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind(
"for"),
24 const auto *FS = Result.Nodes.getNodeAs<ForStmt>(
"for");
26 diag(FS->getInc()->getExprLoc(),
"loop induction expression should not have "
27 "floating-point type");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.