2 #include <clang/AST/AST.h> 3 #include <clang/AST/ASTConsumer.h> 4 #include <clang/AST/DeclGroup.h> 5 #include <clang/AST/RecursiveASTVisitor.h> 6 #include <clang/AST/Expr.h> 15 const clang::ento::ProgramStateRef state = ctx.getState();
16 const clang::LocationContext *LC = ctx.getLocationContext();
17 const clang::Expr *Callee = CE->getCallee();
18 const clang::FunctionDecl *FD = state->getSVal(Callee, LC).getAsFunctionDecl();
24 clang::IdentifierInfo *II = FD->getIdentifier();
28 if (!II->isStr(
"isnan") && !II->isStr(
"isinf"))
31 clang::ento::ExplodedNode *
N = ctx.generateErrorNode();
36 BT.reset(
new clang::ento::BugType(
this,
37 "std::isnan / std::isinf does not work when fast-math is used. Please use " 38 "edm::isNotFinite from 'FWCore/Utilities/interface/isFinite.h'",
41 std::unique_ptr<clang::ento::BugReport>
report = llvm::make_unique<clang::ento::BugReport>(*
BT, BT->getName(),
N);
42 report->addRange(Callee->getSourceRange());
std::unique_ptr< clang::ento::BugType > BT
void checkPreStmt(const clang::CallExpr *ref, clang::ento::CheckerContext &C) const