clang 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::ento::retaincountchecker::RefVal Class Reference

Metadata on reference. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h"

Public Types

enum  Kind {
  Owned = 0 , NotOwned , Released , ReturnedOwned ,
  ReturnedNotOwned , ERROR_START , ErrorDeallocNotOwned , ErrorUseAfterRelease ,
  ErrorReleaseNotOwned , ERROR_LEAK_START , ErrorLeak , ErrorLeakReturned ,
  ErrorOverAutorelease , ErrorReturnedNotOwned
}
 
enum class  IvarAccessHistory { None , AccessedDirectly , ReleasedAfterDirectAccess }
 Tracks how an object referenced by an ivar has been used. More...
 

Public Member Functions

Kind getKind () const
 
ObjKind getObjKind () const
 
unsigned getCount () const
 
unsigned getAutoreleaseCount () const
 
unsigned getCombinedCounts () const
 
void clearCounts ()
 
void setCount (unsigned i)
 
void setAutoreleaseCount (unsigned i)
 
QualType getType () const
 
IvarAccessHistory getIvarAccessHistory () const
 Returns what the analyzer knows about direct accesses to a particular instance variable.
 
bool isOwned () const
 
bool isNotOwned () const
 
bool isReturnedOwned () const
 
bool isReturnedNotOwned () const
 
RefVal operator- (size_t i) const
 
RefVal operator+ (size_t i) const
 
RefVal operator^ (Kind k) const
 
RefVal autorelease () const
 
RefVal withIvarAccess () const
 
RefVal releaseViaIvar () const
 
bool hasSameState (const RefVal &X) const
 
bool operator== (const RefVal &X) const
 
void Profile (llvm::FoldingSetNodeID &ID) const
 
void print (raw_ostream &Out) const
 

Static Public Member Functions

static RefVal makeOwned (ObjKind o, QualType t)
 Create a state for an object whose lifetime is the responsibility of the current function, at least partially.
 
static RefVal makeNotOwned (ObjKind o, QualType t)
 Create a state for an object whose lifetime is not the responsibility of the current function.
 

Detailed Description

Metadata on reference.

Definition at line 50 of file RetainCountChecker.h.

Member Enumeration Documentation

◆ IvarAccessHistory

Tracks how an object referenced by an ivar has been used.

This accounts for us not knowing if an arbitrary ivar is supposed to be stored at +0 or +1.

Enumerator
None 
AccessedDirectly 
ReleasedAfterDirectAccess 

Definition at line 74 of file RetainCountChecker.h.

◆ Kind

Enumerator
Owned 
NotOwned 
Released 
ReturnedOwned 
ReturnedNotOwned 
ERROR_START 
ErrorDeallocNotOwned 
ErrorUseAfterRelease 
ErrorReleaseNotOwned 
ERROR_LEAK_START 
ErrorLeak 
ErrorLeakReturned 
ErrorOverAutorelease 
ErrorReturnedNotOwned 

Definition at line 52 of file RetainCountChecker.h.

Member Function Documentation

◆ autorelease()

RefVal clang::ento::retaincountchecker::RefVal::autorelease ( ) const
inline

◆ clearCounts()

void clang::ento::retaincountchecker::RefVal::clearCounts ( )
inline

Definition at line 129 of file RetainCountChecker.h.

◆ getAutoreleaseCount()

unsigned clang::ento::retaincountchecker::RefVal::getAutoreleaseCount ( ) const
inline

◆ getCombinedCounts()

unsigned clang::ento::retaincountchecker::RefVal::getCombinedCounts ( ) const
inline

Definition at line 128 of file RetainCountChecker.h.

Referenced by shouldGenerateNote().

◆ getCount()

unsigned clang::ento::retaincountchecker::RefVal::getCount ( ) const
inline

◆ getIvarAccessHistory()

IvarAccessHistory clang::ento::retaincountchecker::RefVal::getIvarAccessHistory ( ) const
inline

Returns what the analyzer knows about direct accesses to a particular instance variable.

If the object with this refcount wasn't originally from an Objective-C ivar region, this should always return IvarAccessHistory::None.

Definition at line 147 of file RetainCountChecker.h.

Referenced by autorelease(), hasSameState(), operator+(), operator-(), operator^(), print(), releaseViaIvar(), shouldGenerateNote(), and withIvarAccess().

◆ getKind()

Kind clang::ento::retaincountchecker::RefVal::getKind ( ) const
inline

◆ getObjKind()

ObjKind clang::ento::retaincountchecker::RefVal::getObjKind ( ) const
inline

◆ getType()

QualType clang::ento::retaincountchecker::RefVal::getType ( ) const
inline

Definition at line 140 of file RetainCountChecker.h.

References clang::T.

Referenced by autorelease(), operator+(), operator-(), operator^(), releaseViaIvar(), and withIvarAccess().

◆ hasSameState()

bool clang::ento::retaincountchecker::RefVal::hasSameState ( const RefVal X) const
inline

Definition at line 216 of file RetainCountChecker.h.

References getIvarAccessHistory(), getKind(), and X.

Referenced by operator==(), and shouldGenerateNote().

◆ isNotOwned()

bool clang::ento::retaincountchecker::RefVal::isNotOwned ( ) const
inline

◆ isOwned()

bool clang::ento::retaincountchecker::RefVal::isOwned ( ) const
inline

◆ isReturnedNotOwned()

bool clang::ento::retaincountchecker::RefVal::isReturnedNotOwned ( ) const
inline

Definition at line 163 of file RetainCountChecker.h.

References getKind(), and ReturnedNotOwned.

◆ isReturnedOwned()

bool clang::ento::retaincountchecker::RefVal::isReturnedOwned ( ) const
inline

Definition at line 159 of file RetainCountChecker.h.

References getKind(), and ReturnedOwned.

◆ makeNotOwned()

static RefVal clang::ento::retaincountchecker::RefVal::makeNotOwned ( ObjKind  o,
QualType  t 
)
inlinestatic

Create a state for an object whose lifetime is not the responsibility of the current function.

Most commonly, this is an unowned object with a retain count of +0.

Definition at line 179 of file RetainCountChecker.h.

References None, and NotOwned.

Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkBeginFunction(), clang::ento::retaincountchecker::RetainCountChecker::checkPostStmt(), clang::ento::retaincountchecker::RetainCountChecker::processObjCLiterals(), refValFromRetEffect(), and updateOutParameters().

◆ makeOwned()

static RefVal clang::ento::retaincountchecker::RefVal::makeOwned ( ObjKind  o,
QualType  t 
)
inlinestatic

Create a state for an object whose lifetime is the responsibility of the current function, at least partially.

Most commonly, this is an owned object with a retain count of +1.

Definition at line 171 of file RetainCountChecker.h.

References None, and Owned.

Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkBeginFunction(), refValFromRetEffect(), and updateOutParameters().

◆ operator+()

RefVal clang::ento::retaincountchecker::RefVal::operator+ ( size_t  i) const
inline

◆ operator-()

RefVal clang::ento::retaincountchecker::RefVal::operator- ( size_t  i) const
inline

◆ operator==()

bool clang::ento::retaincountchecker::RefVal::operator== ( const RefVal X) const
inline

Definition at line 221 of file RetainCountChecker.h.

References getObjKind(), hasSameState(), clang::T, and X.

◆ operator^()

RefVal clang::ento::retaincountchecker::RefVal::operator^ ( Kind  k) const
inline

◆ print()

void RefVal::print ( raw_ostream &  Out) const

◆ Profile()

void clang::ento::retaincountchecker::RefVal::Profile ( llvm::FoldingSetNodeID &  ID) const
inline

Definition at line 225 of file RetainCountChecker.h.

References clang::T.

◆ releaseViaIvar()

RefVal clang::ento::retaincountchecker::RefVal::releaseViaIvar ( ) const
inline

◆ setAutoreleaseCount()

void clang::ento::retaincountchecker::RefVal::setAutoreleaseCount ( unsigned  i)
inline

Definition at line 136 of file RetainCountChecker.h.

◆ setCount()

void clang::ento::retaincountchecker::RefVal::setCount ( unsigned  i)
inline

Definition at line 133 of file RetainCountChecker.h.

◆ withIvarAccess()

RefVal clang::ento::retaincountchecker::RefVal::withIvarAccess ( ) const
inline

The documentation for this class was generated from the following files: