#include "ErrnoModeling.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.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/CheckerHelpers.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include <optional>
#include <string>
usingnamespaceclang;
usingnamespaceclang::ento;
namespace {
class StdLibraryFunctionsChecker
: public Checker<check::PreCall, check::PostCall, eval::Call> { … };
int StdLibraryFunctionsChecker::ErrnoConstraintBase::Tag = …;
const StdLibraryFunctionsChecker::ArgNo StdLibraryFunctionsChecker::Ret = …;
static BasicValueFactory &getBVF(ProgramStateRef State) { … }
}
void StdLibraryFunctionsChecker::printArgDesc(
StdLibraryFunctionsChecker::ArgNo ArgN, llvm::raw_ostream &Out) { … }
void StdLibraryFunctionsChecker::printArgValueInfo(ArgNo ArgN,
ProgramStateRef State,
const CallEvent &Call,
llvm::raw_ostream &Out) { … }
void StdLibraryFunctionsChecker::appendInsideRangeDesc(llvm::APSInt RMin,
llvm::APSInt RMax,
QualType ArgT,
BasicValueFactory &BVF,
llvm::raw_ostream &Out) { … }
void StdLibraryFunctionsChecker::appendOutOfRangeDesc(llvm::APSInt RMin,
llvm::APSInt RMax,
QualType ArgT,
BasicValueFactory &BVF,
llvm::raw_ostream &Out) { … }
void StdLibraryFunctionsChecker::RangeConstraint::applyOnWithinRange(
BasicValueFactory &BVF, QualType ArgT, const RangeApplyFunction &F) const { … }
void StdLibraryFunctionsChecker::RangeConstraint::applyOnOutOfRange(
BasicValueFactory &BVF, QualType ArgT, const RangeApplyFunction &F) const { … }
ProgramStateRef StdLibraryFunctionsChecker::RangeConstraint::apply(
ProgramStateRef State, const CallEvent &Call, const Summary &Summary,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::RangeConstraint::describe(
DescriptionKind DK, const CallEvent &Call, ProgramStateRef State,
const Summary &Summary, llvm::raw_ostream &Out) const { … }
bool StdLibraryFunctionsChecker::RangeConstraint::describeArgumentValue(
const CallEvent &Call, ProgramStateRef State, const Summary &Summary,
llvm::raw_ostream &Out) const { … }
ProgramStateRef StdLibraryFunctionsChecker::ComparisonConstraint::apply(
ProgramStateRef State, const CallEvent &Call, const Summary &Summary,
CheckerContext &C) const { … }
ProgramStateRef StdLibraryFunctionsChecker::NotNullConstraint::apply(
ProgramStateRef State, const CallEvent &Call, const Summary &Summary,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::NotNullConstraint::describe(
DescriptionKind DK, const CallEvent &Call, ProgramStateRef State,
const Summary &Summary, llvm::raw_ostream &Out) const { … }
bool StdLibraryFunctionsChecker::NotNullConstraint::describeArgumentValue(
const CallEvent &Call, ProgramStateRef State, const Summary &Summary,
llvm::raw_ostream &Out) const { … }
ProgramStateRef StdLibraryFunctionsChecker::NotNullBufferConstraint::apply(
ProgramStateRef State, const CallEvent &Call, const Summary &Summary,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::NotNullBufferConstraint::describe(
DescriptionKind DK, const CallEvent &Call, ProgramStateRef State,
const Summary &Summary, llvm::raw_ostream &Out) const { … }
bool StdLibraryFunctionsChecker::NotNullBufferConstraint::describeArgumentValue(
const CallEvent &Call, ProgramStateRef State, const Summary &Summary,
llvm::raw_ostream &Out) const { … }
ProgramStateRef StdLibraryFunctionsChecker::BufferSizeConstraint::apply(
ProgramStateRef State, const CallEvent &Call, const Summary &Summary,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::BufferSizeConstraint::describe(
DescriptionKind DK, const CallEvent &Call, ProgramStateRef State,
const Summary &Summary, llvm::raw_ostream &Out) const { … }
bool StdLibraryFunctionsChecker::BufferSizeConstraint::describeArgumentValue(
const CallEvent &Call, ProgramStateRef State, const Summary &Summary,
llvm::raw_ostream &Out) const { … }
void StdLibraryFunctionsChecker::checkPreCall(const CallEvent &Call,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::checkPostCall(const CallEvent &Call,
CheckerContext &C) const { … }
bool StdLibraryFunctionsChecker::evalCall(const CallEvent &Call,
CheckerContext &C) const { … }
bool StdLibraryFunctionsChecker::Signature::matches(
const FunctionDecl *FD) const { … }
std::optional<StdLibraryFunctionsChecker::Summary>
StdLibraryFunctionsChecker::findFunctionSummary(const FunctionDecl *FD,
CheckerContext &C) const { … }
std::optional<StdLibraryFunctionsChecker::Summary>
StdLibraryFunctionsChecker::findFunctionSummary(const CallEvent &Call,
CheckerContext &C) const { … }
void StdLibraryFunctionsChecker::initFunctionSummaries(
CheckerContext &C) const { … }
void ento::registerStdCLibraryFunctionsChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterStdCLibraryFunctionsChecker(
const CheckerManager &mgr) { … }
void ento::registerStdCLibraryFunctionsTesterChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterStdCLibraryFunctionsTesterChecker(
const CheckerManager &mgr) { … }