CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
clangcms::FMWalkAST Class Reference
Inheritance diagram for clangcms::FMWalkAST:

Public Member Functions

 FMWalkAST (const CheckerBase *checker, clang::ento::BugReporter &br, clang::AnalysisDeclContext *ac, const NamedDecl *nd)
 
void VisitCallExpr (clang::CallExpr *CE)
 
void VisitChildren (clang::Stmt *S)
 
void VisitStmt (clang::Stmt *S)
 

Private Attributes

clang::AnalysisDeclContext * AC
 
clang::ento::BugReporter & BR
 
const CheckerBase * Checker
 
const NamedDecl * ND
 

Detailed Description

Definition at line 20 of file FiniteMathChecker.cc.

Constructor & Destructor Documentation

◆ FMWalkAST()

clangcms::FMWalkAST::FMWalkAST ( const CheckerBase *  checker,
clang::ento::BugReporter &  br,
clang::AnalysisDeclContext *  ac,
const NamedDecl *  nd 
)
inline

Definition at line 27 of file FiniteMathChecker.cc.

31  : Checker(checker), BR(br), AC(ac), ND(nd) {}
clang::AnalysisDeclContext * AC
const NamedDecl * ND
const CheckerBase * Checker
clang::ento::BugReporter & BR

Member Function Documentation

◆ VisitCallExpr()

void clangcms::FMWalkAST::VisitCallExpr ( clang::CallExpr *  CE)

Definition at line 46 of file FiniteMathChecker.cc.

References clangcms::support::isInterestingLocation(), eostools::move(), zeeHLT_cff::report, and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
47  const clang::Expr *Callee = CE->getCallee();
48  const FunctionDecl *FD = CE->getDirectCallee();
49  if (!FD)
50  return;
51 
52  const char *sfile = BR.getSourceManager().getPresumedLoc(CE->getExprLoc()).getFilename();
53  std::string sname(sfile);
55  return;
56 
57  // Get the name of the callee.
58  clang::IdentifierInfo *II = FD->getIdentifier();
59  if (!II) // if no identifier, not a simple C function
60  return;
61 
62  if (!II->isStr("isnan") && !II->isStr("isinf"))
63  return;
64 
65  clang::ento::PathDiagnosticLocation CELoc =
66  clang::ento::PathDiagnosticLocation::createBegin(CE, BR.getSourceManager(), AC);
67  BugType *BT = new clang::ento::BugType(Checker,
68  "std::isnan / std::isinf does not work when fast-math is used. Please use "
69  "edm::isNotFinite from 'FWCore/Utilities/interface/isFinite.h'",
70  "fastmath plugin");
71  std::unique_ptr<clang::ento::BasicBugReport> report =
72  std::make_unique<clang::ento::BasicBugReport>(*BT, BT->getCheckerName(), CELoc);
73  BR.emitReport(std::move(report));
74  }
clang::AnalysisDeclContext * AC
bool isInterestingLocation(const std::string &d)
const CheckerBase * Checker
clang::ento::BugReporter & BR
def move(src, dest)
Definition: eostools.py:511

◆ VisitChildren()

void clangcms::FMWalkAST::VisitChildren ( clang::Stmt *  S)

Definition at line 39 of file FiniteMathChecker.cc.

References Exhume::I.

39  {
40  for (clang::Stmt::child_iterator I = S->child_begin(), E = S->child_end(); I != E; ++I)
41  if (clang::Stmt *child = *I) {
42  Visit(child);
43  }
44  }
const std::complex< double > I
Definition: I.h:8

◆ VisitStmt()

void clangcms::FMWalkAST::VisitStmt ( clang::Stmt *  S)
inline

Definition at line 35 of file FiniteMathChecker.cc.

35 { VisitChildren(S); }
void VisitChildren(clang::Stmt *S)

Member Data Documentation

◆ AC

clang::AnalysisDeclContext* clangcms::FMWalkAST::AC
private

Definition at line 23 of file FiniteMathChecker.cc.

◆ BR

clang::ento::BugReporter& clangcms::FMWalkAST::BR
private

Definition at line 22 of file FiniteMathChecker.cc.

◆ Checker

const CheckerBase* clangcms::FMWalkAST::Checker
private

Definition at line 21 of file FiniteMathChecker.cc.

◆ ND

const NamedDecl* clangcms::FMWalkAST::ND
private

Definition at line 24 of file FiniteMathChecker.cc.