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> 17 const clang::ento::ProgramStateRef state = ctx.getState();
18 const clang::LocationContext *LC = ctx.getLocationContext();
19 const clang::Expr *Callee = CE->getCallee();
20 const clang::FunctionDecl *FD = state->getSVal(Callee, LC).getAsFunctionDecl();
26 clang::IdentifierInfo *II = FD->getIdentifier();
30 if (!II->isStr(
"isnan") && !II->isStr(
"isinf"))
33 clang::ento::ExplodedNode *
N = ctx.generateErrorNode();
38 BT.reset(
new clang::ento::BugType(
this,
"std::isnan / std::isinf does not work when fast-math is used. Please use edm::isNotFinite from 'FWCore/Utilities/interface/isFinite.h'",
"fastmath plugin"));
40 std::unique_ptr<clang::ento::BugReport>
report = llvm::make_unique<clang::ento::BugReport>(*
BT, BT->getName(),
N);
41 report->addRange(Callee->getSourceRange());
std::unique_ptr< clang::ento::BugType > BT
void checkPreStmt(const clang::CallExpr *ref, clang::ento::CheckerContext &C) const