#include "ErrnoModeling.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "llvm/ADT/STLExtras.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespaceerrno_modeling;
namespace {
class ErrnoChecker
: public Checker<check::Location, check::PreCall, check::RegionChanges> { … };
}
static ProgramStateRef setErrnoStateIrrelevant(ProgramStateRef State) { … }
static bool isInCondition(const Stmt *S, CheckerContext &C) { … }
void ErrnoChecker::generateErrnoNotCheckedBug(
CheckerContext &C, ProgramStateRef State, const MemRegion *ErrnoRegion,
const CallEvent *CallMayChangeErrno) const { … }
void ErrnoChecker::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
CheckerContext &C) const { … }
void ErrnoChecker::checkPreCall(const CallEvent &Call,
CheckerContext &C) const { … }
ProgramStateRef ErrnoChecker::checkRegionChanges(
ProgramStateRef State, const InvalidatedSymbols *Invalidated,
ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions, const LocationContext *LCtx,
const CallEvent *Call) const { … }
void ento::registerErrnoChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterErrnoChecker(const CheckerManager &mgr) { … }