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

//===-- MismatchedIteratorChecker.cpp -----------------------------*- C++ -*--//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// Defines a checker for mistakenly applying a foreign iterator on a container
// and for using iterators of two different containers in a context where
// iterators of the same container should be used.
//
//===----------------------------------------------------------------------===//

#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 "Iterator.h"

usingnamespaceclang;
usingnamespaceento;
usingnamespaceiterator;

namespace {

class MismatchedIteratorChecker
  : public Checker<check::PreCall, check::PreStmt<BinaryOperator>> {};

} // namespace

void MismatchedIteratorChecker::checkPreCall(const CallEvent &Call,
                                             CheckerContext &C) const {}

void MismatchedIteratorChecker::checkPreStmt(const BinaryOperator *BO,
                                             CheckerContext &C) const {}

void MismatchedIteratorChecker::verifyMatch(CheckerContext &C, SVal Iter,
                                            const MemRegion *Cont) const {}

void MismatchedIteratorChecker::verifyMatch(CheckerContext &C, SVal Iter1,
                                            SVal Iter2) const {}

void MismatchedIteratorChecker::reportBug(StringRef Message, SVal Val1,
                                          SVal Val2, CheckerContext &C,
                                          ExplodedNode *ErrNode) const {}

void MismatchedIteratorChecker::reportBug(StringRef Message, SVal Val,
                                          const MemRegion *Reg,
                                          CheckerContext &C,
                                          ExplodedNode *ErrNode) const {}

void ento::registerMismatchedIteratorChecker(CheckerManager &mgr) {}

bool ento::shouldRegisterMismatchedIteratorChecker(const CheckerManager &mgr) {}