#include "RetainCountChecker.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespaceretaincountchecker;
REGISTER_MAP_WITH_PROGRAMSTATE(…)
namespace clang {
namespace ento {
namespace retaincountchecker {
const RefVal *getRefBinding(ProgramStateRef State, SymbolRef Sym) { … }
}
}
}
static ProgramStateRef setRefBinding(ProgramStateRef State, SymbolRef Sym,
RefVal Val) { … }
static ProgramStateRef removeRefBinding(ProgramStateRef State, SymbolRef Sym) { … }
void RefVal::print(raw_ostream &Out) const { … }
namespace {
class StopTrackingCallback final : public SymbolVisitor { … };
}
void RetainCountChecker::checkPostStmt(const BlockExpr *BE,
CheckerContext &C) const { … }
void RetainCountChecker::checkPostStmt(const CastExpr *CE,
CheckerContext &C) const { … }
void RetainCountChecker::processObjCLiterals(CheckerContext &C,
const Expr *Ex) const { … }
void RetainCountChecker::checkPostStmt(const ObjCArrayLiteral *AL,
CheckerContext &C) const { … }
void RetainCountChecker::checkPostStmt(const ObjCDictionaryLiteral *DL,
CheckerContext &C) const { … }
void RetainCountChecker::checkPostStmt(const ObjCBoxedExpr *Ex,
CheckerContext &C) const { … }
void RetainCountChecker::checkPostStmt(const ObjCIvarRefExpr *IRE,
CheckerContext &C) const { … }
static bool isReceiverUnconsumedSelf(const CallEvent &Call) { … }
const static RetainSummary *getSummary(RetainSummaryManager &Summaries,
const CallEvent &Call,
QualType ReceiverType) { … }
void RetainCountChecker::checkPostCall(const CallEvent &Call,
CheckerContext &C) const { … }
static QualType GetReturnType(const Expr *RetE, ASTContext &Ctx) { … }
static std::optional<RefVal> refValFromRetEffect(RetEffect RE,
QualType ResultTy) { … }
static bool isPointerToObject(QualType QT) { … }
static bool shouldEscapeOSArgumentOnCall(const CallEvent &CE, unsigned ArgIdx,
const RefVal *TrackedValue) { … }
void RetainCountChecker::processSummaryOfInlined(const RetainSummary &Summ,
const CallEvent &CallOrMsg,
CheckerContext &C) const { … }
static bool isSmartPtrField(const MemRegion *MR) { … }
static bool shouldEscapeRegion(const MemRegion *R) { … }
static SmallVector<ProgramStateRef, 2>
updateOutParameters(ProgramStateRef State, const RetainSummary &Summ,
const CallEvent &CE) { … }
void RetainCountChecker::checkSummary(const RetainSummary &Summ,
const CallEvent &CallOrMsg,
CheckerContext &C) const { … }
ProgramStateRef RetainCountChecker::updateSymbol(ProgramStateRef state,
SymbolRef sym, RefVal V,
ArgEffect AE,
RefVal::Kind &hasErr,
CheckerContext &C) const { … }
const RefCountBug &
RetainCountChecker::errorKindToBugKind(RefVal::Kind ErrorKind,
SymbolRef Sym) const { … }
void RetainCountChecker::processNonLeakError(ProgramStateRef St,
SourceRange ErrorRange,
RefVal::Kind ErrorKind,
SymbolRef Sym,
CheckerContext &C) const { … }
bool RetainCountChecker::evalCall(const CallEvent &Call,
CheckerContext &C) const { … }
ExplodedNode * RetainCountChecker::processReturn(const ReturnStmt *S,
CheckerContext &C) const { … }
ExplodedNode * RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S,
CheckerContext &C,
ExplodedNode *Pred,
RetEffect RE, RefVal X,
SymbolRef Sym,
ProgramStateRef state) const { … }
void RetainCountChecker::checkBind(SVal loc, SVal val, const Stmt *S,
CheckerContext &C) const { … }
ProgramStateRef RetainCountChecker::evalAssume(ProgramStateRef state,
SVal Cond,
bool Assumption) const { … }
ProgramStateRef RetainCountChecker::checkRegionChanges(
ProgramStateRef state, const InvalidatedSymbols *invalidated,
ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions, const LocationContext *LCtx,
const CallEvent *Call) const { … }
ProgramStateRef
RetainCountChecker::handleAutoreleaseCounts(ProgramStateRef state,
ExplodedNode *Pred,
const ProgramPointTag *Tag,
CheckerContext &Ctx,
SymbolRef Sym,
RefVal V,
const ReturnStmt *S) const { … }
ProgramStateRef
RetainCountChecker::handleSymbolDeath(ProgramStateRef state,
SymbolRef sid, RefVal V,
SmallVectorImpl<SymbolRef> &Leaked) const { … }
ExplodedNode *
RetainCountChecker::processLeaks(ProgramStateRef state,
SmallVectorImpl<SymbolRef> &Leaked,
CheckerContext &Ctx,
ExplodedNode *Pred) const { … }
void RetainCountChecker::checkBeginFunction(CheckerContext &Ctx) const { … }
void RetainCountChecker::checkEndFunction(const ReturnStmt *RS,
CheckerContext &Ctx) const { … }
void RetainCountChecker::checkDeadSymbols(SymbolReaper &SymReaper,
CheckerContext &C) const { … }
void RetainCountChecker::printState(raw_ostream &Out, ProgramStateRef State,
const char *NL, const char *Sep) const { … }
std::unique_ptr<CheckerProgramPointTag> RetainCountChecker::DeallocSentTag;
std::unique_ptr<CheckerProgramPointTag> RetainCountChecker::CastFailTag;
void ento::registerRetainCountBase(CheckerManager &Mgr) { … }
bool ento::shouldRegisterRetainCountBase(const CheckerManager &mgr) { … }
void ento::registerRetainCountChecker(CheckerManager &Mgr) { … }
bool ento::shouldRegisterRetainCountChecker(const CheckerManager &mgr) { … }
void ento::registerOSObjectRetainCountChecker(CheckerManager &Mgr) { … }
bool ento::shouldRegisterOSObjectRetainCountChecker(const CheckerManager &mgr) { … }