#include <FiniteMathChecker.h>
Public Member Functions | |
void | checkPreStmt (const clang::CallExpr *ref, clang::ento::CheckerContext &C) const |
Private Attributes | |
llvm::OwningPtr < clang::ento::BugType > | BT |
Definition at line 11 of file FiniteMathChecker.h.
afs cern ch work a aaltunda public www CMSSW_6_2_5 src Utilities StaticAnalyzers src FiniteMathChecker cc void clangcms::FiniteMathChecker::checkPreStmt | ( | const clang::CallExpr * | ref, |
clang::ento::CheckerContext & | C | ||
) | const |
Definition at line 15 of file FiniteMathChecker.cc.
References BT, N, and zeeHLT_cff::report.
{ const clang::ento::ProgramStateRef state = ctx.getState(); const clang::LocationContext *LC = ctx.getLocationContext(); const clang::Expr *Callee = CE->getCallee(); const clang::FunctionDecl *FD = state->getSVal(Callee, LC).getAsFunctionDecl(); if (!FD) return; // Get the name of the callee. clang::IdentifierInfo *II = FD->getIdentifier(); if (!II) // if no identifier, not a simple C function return; if (!II->isStr("isnan") && !II->isStr("isinf")) return; clang::ento::ExplodedNode *N = ctx.generateSink(); if (!N) return; if (!BT) BT.reset(new clang::ento::BugType("std::isnan / std::isinf does not work when fast-math is used. Please use edm::isNotFinite from 'FWCore/Utilities/interface/isNotFinite.h'", "fastmath plugin")); clang::ento::BugReport *report = new clang::ento::BugReport(*BT, BT->getName(), N); report->addRange(Callee->getSourceRange()); ctx.emitReport(report); } }
llvm::OwningPtr<clang::ento::BugType> clangcms::FiniteMathChecker::BT [mutable, private] |
Definition at line 12 of file FiniteMathChecker.h.
Referenced by checkPreStmt().