clang 20.0.0git
|
Static Public Member Functions | |
static const CheckerProgramPointTag & | getDeallocSentTag () |
static const CheckerProgramPointTag & | getCastFailTag () |
Static Public Member Functions inherited from clang::ento::Checker< check::Bind, check::DeadSymbols, check::BeginFunction, check::EndFunction, check::PostStmt< BlockExpr >, check::PostStmt< CastExpr >, check::PostStmt< ObjCArrayLiteral >, check::PostStmt< ObjCDictionaryLiteral >, check::PostStmt< ObjCBoxedExpr >, check::PostStmt< ObjCIvarRefExpr >, check::PostCall, check::RegionChanges, eval::Assume, eval::Call > | |
static void | _register (CHECKER *checker, CheckerManager &mgr) |
Static Public Member Functions inherited from clang::ento::check::Bind | |
template<typename CHECKER > | |
static void | _register (CHECKER *checker, CheckerManager &mgr) |
Public Attributes | |
std::unique_ptr< RefCountBug > | UseAfterRelease |
std::unique_ptr< RefCountBug > | ReleaseNotOwned |
std::unique_ptr< RefCountBug > | DeallocNotOwned |
std::unique_ptr< RefCountBug > | FreeNotOwned |
std::unique_ptr< RefCountBug > | OverAutorelease |
std::unique_ptr< RefCountBug > | ReturnNotOwnedForOwned |
std::unique_ptr< RefCountBug > | LeakWithinFunction |
std::unique_ptr< RefCountBug > | LeakAtReturn |
std::unique_ptr< RetainSummaryManager > | Summaries |
bool | TrackObjCAndCFObjects = false |
Track Objective-C and CoreFoundation objects. | |
bool | TrackOSObjects = false |
Track sublcasses of OSObject. | |
bool | TrackNSCFStartParam = false |
Track initial parameters (for the entry point) for NS/CF objects. | |
Static Public Attributes | |
static std::unique_ptr< CheckerProgramPointTag > | DeallocSentTag |
static std::unique_ptr< CheckerProgramPointTag > | CastFailTag |
Definition at line 237 of file RetainCountChecker.h.
|
inline |
Definition at line 277 of file RetainCountChecker.h.
void RetainCountChecker::checkBeginFunction | ( | CheckerContext & | C | ) | const |
Definition at line 1331 of file RetainCountChecker.cpp.
References clang::ento::CheckerContext::addTransition(), clang::C, clang::ento::CF, D, clang::ento::DecRef, clang::AnyCall::forDecl(), clang::ento::Generalized, clang::ento::RetainSummary::getArgEffects(), clang::LocationContext::getDecl(), clang::ento::ArgEffect::getKind(), clang::ento::CheckerContext::getLocationContext(), clang::ento::ArgEffect::getObjKind(), clang::ento::CheckerContext::getState(), clang::ento::RetainSummaryManager::getSummary(), getSummaryManager(), clang::ValueDecl::getType(), clang::ento::CheckerContext::inTopFrame(), clang::ento::RetainSummaryManager::isTrustedReferenceCountImplementation(), clang::ento::retaincountchecker::RefVal::makeNotOwned(), clang::ento::retaincountchecker::RefVal::makeOwned(), clang::ento::ObjC, clang::ento::OS, setRefBinding(), and TrackNSCFStartParam.
void RetainCountChecker::checkBind | ( | SVal | loc, |
SVal | val, | ||
const Stmt * | S, | ||
CheckerContext & | C | ||
) | const |
Definition at line 1137 of file RetainCountChecker.cpp.
References clang::C, clang::ento::SVal::getAsRegion(), and shouldEscapeRegion().
void RetainCountChecker::checkDeadSymbols | ( | SymbolReaper & | SymReaper, |
CheckerContext & | C | ||
) | const |
Definition at line 1409 of file RetainCountChecker.cpp.
References clang::C, clang::ento::retaincountchecker::getRefBinding(), handleAutoreleaseCounts(), handleSymbolDeath(), clang::ento::SymbolReaper::isDead(), processLeaks(), and V.
void RetainCountChecker::checkEndFunction | ( | const ReturnStmt * | RS, |
CheckerContext & | C | ||
) | const |
Definition at line 1367 of file RetainCountChecker.cpp.
References clang::ento::ExplodedNode::getLocationContext(), clang::ento::ExplodedNode::getState(), handleAutoreleaseCounts(), handleSymbolDeath(), and processLeaks().
void RetainCountChecker::checkPostCall | ( | const CallEvent & | Call, |
CheckerContext & | C | ||
) | const |
Definition at line 362 of file RetainCountChecker.cpp.
References clang::C, clang::Call, checkSummary(), clang::ento::SVal::getAsLocSymbol(), clang::ento::retaincountchecker::getRefBinding(), getSummary(), getSummaryManager(), processSummaryOfInlined(), Summaries, and clang::T.
void RetainCountChecker::checkPostStmt | ( | const BlockExpr * | BE, |
CheckerContext & | C | ||
) | const |
Definition at line 147 of file RetainCountChecker.cpp.
References clang::C, clang::BlockExpr::getBlockDecl(), clang::ento::VarRegion::getDecl(), clang::ento::SubRegion::getSuperRegion(), clang::ento::MemRegionManager::getVarRegion(), and clang::BlockDecl::hasCaptures().
void RetainCountChecker::checkPostStmt | ( | const CastExpr * | CE, |
CheckerContext & | C | ||
) | const |
Definition at line 181 of file RetainCountChecker.cpp.
References clang::C, clang::ento::CF, clang::ento::DecRefBridgedTransferred, clang::ObjCBridgedCastExpr::getBridgeKind(), clang::ento::retaincountchecker::getRefBinding(), clang::Expr::getType(), clang::ento::IncRef, clang::Type::isObjCObjectPointerType(), clang::OBC_Bridge, clang::OBC_BridgeRetained, clang::OBC_BridgeTransfer, clang::ento::ObjC, clang::T, updateSymbol(), and clang::ento::ArgEffect::withKind().
void RetainCountChecker::checkPostStmt | ( | const ObjCArrayLiteral * | AL, |
CheckerContext & | C | ||
) | const |
Definition at line 258 of file RetainCountChecker.cpp.
References clang::C, and processObjCLiterals().
void RetainCountChecker::checkPostStmt | ( | const ObjCBoxedExpr * | BE, |
CheckerContext & | C | ||
) | const |
Definition at line 270 of file RetainCountChecker.cpp.
References clang::C, clang::ento::SVal::getAsSymbol(), clang::ento::ExplodedNode::getState(), clang::ento::ExplodedNode::getSVal(), clang::Expr::getType(), clang::ento::retaincountchecker::RefVal::makeNotOwned(), clang::ento::ObjC, and setRefBinding().
void RetainCountChecker::checkPostStmt | ( | const ObjCDictionaryLiteral * | DL, |
CheckerContext & | C | ||
) | const |
Definition at line 264 of file RetainCountChecker.cpp.
References clang::C, and processObjCLiterals().
void RetainCountChecker::checkPostStmt | ( | const ObjCIvarRefExpr * | IRE, |
CheckerContext & | C | ||
) | const |
Definition at line 284 of file RetainCountChecker.cpp.
References clang::C, clang::ento::CF, clang::ento::SymExpr::getOriginRegion(), clang::ento::retaincountchecker::getRefBinding(), clang::ento::SymExpr::getType(), clang::ento::coreFoundation::isCFObjectRef(), clang::ento::ConditionTruthVal::isConstrainedTrue(), clang::ento::ConstraintManager::isNull(), clang::Type::isObjCRetainableType(), clang::ento::retaincountchecker::isSynthesizedAccessor(), clang::ento::retaincountchecker::RefVal::makeNotOwned(), clang::ento::retaincountchecker::RefVal::None, clang::ento::ObjC, setRefBinding(), and clang::ento::retaincountchecker::RefVal::withIvarAccess().
ProgramStateRef RetainCountChecker::checkRegionChanges | ( | ProgramStateRef | state, |
const InvalidatedSymbols * | invalidated, | ||
ArrayRef< const MemRegion * > | ExplicitRegions, | ||
ArrayRef< const MemRegion * > | Regions, | ||
const LocationContext * | LCtx, | ||
const CallEvent * | Call | ||
) | const |
Definition at line 1183 of file RetainCountChecker.cpp.
References clang::ento::MemRegion::getAs(), removeRefBinding(), and clang::ento::MemRegion::StripCasts().
ExplodedNode * RetainCountChecker::checkReturnWithRetEffect | ( | const ReturnStmt * | S, |
CheckerContext & | C, | ||
ExplodedNode * | Pred, | ||
RetEffect | RE, | ||
RefVal | X, | ||
SymbolRef | Sym, | ||
ProgramStateRef | state | ||
) | const |
Definition at line 1066 of file RetainCountChecker.cpp.
References clang::ento::retaincountchecker::RefVal::AccessedDirectly, clang::C, clang::ento::retaincountchecker::RefVal::ErrorLeakReturned, clang::ento::retaincountchecker::RefVal::ErrorReturnedNotOwned, clang::ento::RetEffect::getKind(), clang::ento::RetEffect::isOwned(), LeakAtReturn, clang::ento::retaincountchecker::RefVal::None, clang::ento::RetEffect::NoRet, clang::ento::retaincountchecker::RefVal::ReturnedOwned, ReturnNotOwnedForOwned, setRefBinding(), and X.
void RetainCountChecker::checkSummary | ( | const RetainSummary & | Summ, |
const CallEvent & | Call, | ||
CheckerContext & | C | ||
) | const |
Definition at line 604 of file RetainCountChecker.cpp.
References clang::C, clang::ento::Dealloc, clang::ento::RetainSummary::getArg(), clang::ento::CallEvent::getArgSourceRange(), clang::ento::CallEvent::getArgSVal(), clang::ento::SVal::getAsSymbol(), getDeallocSentTag(), clang::ento::ArgEffect::getKind(), clang::ento::RetEffect::getKind(), clang::ento::CallEvent::getNumArgs(), clang::ento::RetainSummaryManager::getObjAllocRetEffect(), clang::ento::CallEvent::getOriginExpr(), clang::ento::RetainSummary::getReceiverEffect(), clang::ento::retaincountchecker::getRefBinding(), clang::ento::CallEvent::getResultType(), clang::ento::RetainSummary::getRetEffect(), GetReturnType(), clang::ento::CallEvent::getReturnValue(), getSummaryManager(), clang::ento::RetainSummary::getThisEffect(), clang::ento::RetEffect::MakeNoRet(), clang::ento::RetEffect::notOwned(), clang::ento::OS, clang::ento::RetEffect::OwnedWhenTrackedReceiver, processNonLeakError(), refValFromRetEffect(), setRefBinding(), shouldEscapeOSArgumentOnCall(), clang::ento::StopTrackingHard, clang::T, updateOutParameters(), updateSymbol(), and V.
Referenced by checkPostCall().
const RefCountBug & RetainCountChecker::errorKindToBugKind | ( | RefVal::Kind | ErrorKind, |
SymbolRef | Sym | ||
) | const |
Definition at line 842 of file RetainCountChecker.cpp.
References DeallocNotOwned, clang::ento::retaincountchecker::RefVal::ErrorDeallocNotOwned, clang::ento::retaincountchecker::RefVal::ErrorReleaseNotOwned, clang::ento::retaincountchecker::RefVal::ErrorUseAfterRelease, FreeNotOwned, clang::Type::getPointeeCXXRecordDecl(), clang::ento::SymExpr::getType(), ReleaseNotOwned, and UseAfterRelease.
Referenced by processNonLeakError().
ProgramStateRef RetainCountChecker::evalAssume | ( | ProgramStateRef | state, |
SVal | Cond, | ||
bool | Assumption | ||
) | const |
Definition at line 1150 of file RetainCountChecker.cpp.
References clang::ento::ConditionTruthVal::isConstrainedTrue().
bool RetainCountChecker::evalCall | ( | const CallEvent & | Call, |
CheckerContext & | C | ||
) | const |
Definition at line 888 of file RetainCountChecker.cpp.
References clang::C, clang::Call, clang::ento::RetainSummaryManager::canEval(), clang::ento::SValBuilder::conjureSymbolVal(), clang::ento::SVal::getAs(), getCastFailTag(), getSummaryManager(), clang::QualType::isNull(), and clang::ento::SVal::isUnknown().
|
inlinestatic |
Definition at line 366 of file RetainCountChecker.h.
References CastFailTag.
Referenced by evalCall(), and clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode().
|
inlinestatic |
Definition at line 362 of file RetainCountChecker.h.
References DeallocSentTag.
Referenced by checkSummary(), and clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode().
|
inline |
Definition at line 279 of file RetainCountChecker.h.
References Summaries, TrackObjCAndCFObjects, and TrackOSObjects.
Referenced by checkBeginFunction(), checkPostCall(), checkSummary(), evalCall(), and getSummaryManager().
|
inline |
Definition at line 286 of file RetainCountChecker.h.
References clang::C, and getSummaryManager().
ProgramStateRef RetainCountChecker::handleAutoreleaseCounts | ( | ProgramStateRef | state, |
ExplodedNode * | Pred, | ||
const ProgramPointTag * | Tag, | ||
CheckerContext & | Ctx, | ||
SymbolRef | Sym, | ||
RefVal | V, | ||
const ReturnStmt * | S = nullptr |
||
) | const |
Definition at line 1207 of file RetainCountChecker.cpp.
References clang::ento::retaincountchecker::RefVal::AccessedDirectly, clang::ento::CheckerContext::emitReport(), clang::ento::retaincountchecker::RefVal::ErrorOverAutorelease, clang::ento::CheckerContext::generateSink(), clang::ento::CheckerContext::getASTContext(), clang::ASTContext::getLangOpts(), clang::ento::retaincountchecker::RefVal::None, clang::ento::retaincountchecker::RefVal::NotOwned, OverAutorelease, clang::ento::retaincountchecker::RefVal::ReturnedNotOwned, clang::ento::retaincountchecker::RefVal::ReturnedOwned, setRefBinding(), and V.
Referenced by checkDeadSymbols(), and checkEndFunction().
ProgramStateRef RetainCountChecker::handleSymbolDeath | ( | ProgramStateRef | state, |
SymbolRef | sid, | ||
RefVal | V, | ||
SmallVectorImpl< SymbolRef > & | Leaked | ||
) | const |
Definition at line 1285 of file RetainCountChecker.cpp.
References clang::ento::retaincountchecker::RefVal::ErrorLeak, clang::ento::retaincountchecker::RefVal::None, removeRefBinding(), setRefBinding(), and V.
Referenced by checkDeadSymbols(), and checkEndFunction().
|
overridevirtual |
See CheckerManager::runCheckersForPrintState.
Reimplemented from clang::ento::CheckerBase.
Definition at line 1455 of file RetainCountChecker.cpp.
ExplodedNode * RetainCountChecker::processLeaks | ( | ProgramStateRef | state, |
SmallVectorImpl< SymbolRef > & | Leaked, | ||
CheckerContext & | Ctx, | ||
ExplodedNode * | Pred = nullptr |
||
) | const |
Definition at line 1313 of file RetainCountChecker.cpp.
References clang::ento::CheckerContext::addTransition(), clang::ento::CheckerContext::emitReport(), clang::ento::CheckerContext::getASTContext(), clang::ASTContext::getLangOpts(), LeakAtReturn, and LeakWithinFunction.
Referenced by checkDeadSymbols(), and checkEndFunction().
void RetainCountChecker::processNonLeakError | ( | ProgramStateRef | St, |
SourceRange | ErrorRange, | ||
RefVal::Kind | ErrorKind, | ||
SymbolRef | Sym, | ||
CheckerContext & | C | ||
) | const |
Definition at line 858 of file RetainCountChecker.cpp.
References clang::C, errorKindToBugKind(), clang::ento::retaincountchecker::getRefBinding(), and clang::ento::retaincountchecker::RefVal::None.
Referenced by checkSummary(), and processObjCLiterals().
void RetainCountChecker::processObjCLiterals | ( | CheckerContext & | C, |
const Expr * | Ex | ||
) | const |
Definition at line 228 of file RetainCountChecker.cpp.
References clang::C, clang::Stmt::children(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::retaincountchecker::getRefBinding(), clang::ento::ExplodedNode::getSVal(), clang::Expr::getType(), clang::ento::retaincountchecker::RefVal::makeNotOwned(), clang::ento::MayEscape, clang::ento::ObjC, processNonLeakError(), setRefBinding(), clang::T, updateSymbol(), and V.
Referenced by checkPostStmt().
void RetainCountChecker::processSummaryOfInlined | ( | const RetainSummary & | Summ, |
const CallEvent & | Call, | ||
CheckerContext & | C | ||
) | const |
Definition at line 447 of file RetainCountChecker.cpp.
References clang::C, clang::ento::RetainSummary::getArg(), clang::ento::CallEvent::getArgSVal(), clang::ento::SVal::getAsSymbol(), clang::ento::ArgEffect::getKind(), clang::ento::RetEffect::getKind(), clang::ento::CallEvent::getNumArgs(), clang::ento::RetainSummary::getReceiverEffect(), clang::ento::retaincountchecker::getRefBinding(), clang::ento::RetainSummary::getRetEffect(), clang::ento::CallEvent::getReturnValue(), clang::ento::RetEffect::NoRetHard, removeRefBinding(), shouldEscapeOSArgumentOnCall(), clang::ento::StopTrackingHard, clang::T, and V.
Referenced by checkPostCall().
ProgramStateRef RetainCountChecker::updateSymbol | ( | ProgramStateRef | state, |
SymbolRef | sym, | ||
RefVal | V, | ||
ArgEffect | E, | ||
RefVal::Kind & | hasErr, | ||
CheckerContext & | C | ||
) | const |
Definition at line 710 of file RetainCountChecker.cpp.
References clang::ento::retaincountchecker::RefVal::AccessedDirectly, clang::ento::Autorelease, bool, clang::C, clang::ento::Dealloc, clang::ento::DecRef, clang::ento::DecRefAndStopTrackingHard, clang::ento::DecRefBridgedTransferred, clang::ento::DoNothing, clang::ento::retaincountchecker::RefVal::ErrorDeallocNotOwned, clang::ento::retaincountchecker::RefVal::ErrorReleaseNotOwned, clang::ento::retaincountchecker::RefVal::ErrorUseAfterRelease, clang::ento::ArgEffect::getKind(), clang::ento::ArgEffect::getObjKind(), clang::ento::IncRef, clang::ento::MayEscape, clang::ento::retaincountchecker::RefVal::NotOwned, clang::ento::ObjC, clang::ento::retaincountchecker::RefVal::Owned, clang::ento::retaincountchecker::RefVal::Released, removeRefBinding(), clang::ento::RetainedOutParameter, clang::ento::RetainedOutParameterOnNonZero, clang::ento::RetainedOutParameterOnZero, setRefBinding(), clang::ento::StopTracking, clang::ento::StopTrackingHard, clang::ento::UnretainedOutParameter, V, and clang::ento::ArgEffect::withKind().
Referenced by checkPostStmt(), checkSummary(), and processObjCLiterals().
|
static |
Definition at line 266 of file RetainCountChecker.h.
Referenced by getCastFailTag().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::DeallocNotOwned |
Definition at line 256 of file RetainCountChecker.h.
Referenced by errorKindToBugKind().
|
static |
Definition at line 265 of file RetainCountChecker.h.
Referenced by getDeallocSentTag().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::FreeNotOwned |
Definition at line 257 of file RetainCountChecker.h.
Referenced by errorKindToBugKind().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::LeakAtReturn |
Definition at line 261 of file RetainCountChecker.h.
Referenced by checkReturnWithRetEffect(), and processLeaks().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::LeakWithinFunction |
Definition at line 260 of file RetainCountChecker.h.
Referenced by processLeaks().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::OverAutorelease |
Definition at line 258 of file RetainCountChecker.h.
Referenced by handleAutoreleaseCounts().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::ReleaseNotOwned |
Definition at line 255 of file RetainCountChecker.h.
Referenced by errorKindToBugKind().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::ReturnNotOwnedForOwned |
Definition at line 259 of file RetainCountChecker.h.
Referenced by checkReturnWithRetEffect().
|
mutable |
Definition at line 263 of file RetainCountChecker.h.
Referenced by checkPostCall(), and getSummaryManager().
Track initial parameters (for the entry point) for NS/CF objects.
Definition at line 275 of file RetainCountChecker.h.
Referenced by checkBeginFunction().
Track Objective-C and CoreFoundation objects.
Definition at line 269 of file RetainCountChecker.h.
Referenced by getSummaryManager().
Track sublcasses of OSObject.
Definition at line 272 of file RetainCountChecker.h.
Referenced by getSummaryManager().
std::unique_ptr<RefCountBug> clang::ento::retaincountchecker::RetainCountChecker::UseAfterRelease |
Definition at line 254 of file RetainCountChecker.h.
Referenced by errorKindToBugKind().