#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "llvm/ADT/FoldingSet.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
namespace {
class ZeroState { … };
class DivisionBRVisitor : public BugReporterVisitor { … };
class TestAfterDivZeroChecker
: public Checker<check::PreStmt<BinaryOperator>, check::BranchCondition,
check::EndFunction> { … };
}
REGISTER_SET_WITH_PROGRAMSTATE(…)
PathDiagnosticPieceRef
DivisionBRVisitor::VisitNode(const ExplodedNode *Succ, BugReporterContext &BRC,
PathSensitiveBugReport &BR) { … }
bool TestAfterDivZeroChecker::isZero(SVal S, CheckerContext &C) const { … }
void TestAfterDivZeroChecker::setDivZeroMap(SVal Var, CheckerContext &C) const { … }
bool TestAfterDivZeroChecker::hasDivZeroMap(SVal Var,
const CheckerContext &C) const { … }
void TestAfterDivZeroChecker::reportBug(SVal Val, CheckerContext &C) const { … }
void TestAfterDivZeroChecker::checkEndFunction(const ReturnStmt *,
CheckerContext &C) const { … }
void TestAfterDivZeroChecker::checkPreStmt(const BinaryOperator *B,
CheckerContext &C) const { … }
void TestAfterDivZeroChecker::checkBranchCondition(const Stmt *Condition,
CheckerContext &C) const { … }
void ento::registerTestAfterDivZeroChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterTestAfterDivZeroChecker(const CheckerManager &mgr) { … }