llvm/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp

//== TestAfterDivZeroChecker.cpp - Test after division by zero checker --*--==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This defines TestAfterDivZeroChecker, a builtin check that performs checks
//  for division by zero where the division occurs before comparison with zero.
//
//===----------------------------------------------------------------------===//

#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> {};
} // end anonymous namespace

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) {}