clang: lib/StaticAnalyzer/Checkers/MallocChecker.cpp File Reference (original) (raw)

Go to the source code of this file.

Namespaces
namespace clang
The JSON file list parser is used to communicate input to InstallAPI.
namespace clang::ento
namespace clang::ento::allocation_state
Macros
#define CASE(ID) case ID: OS << #ID; break;
#define CHECK_FN(NAME)
#define REGISTER_CHECKER(name)
Functions
static bool printMemFnName (raw_ostream &os, CheckerContext &C, const Expr *E)
Print names of allocators and deallocators.
static void printExpectedAllocName (raw_ostream &os, AllocationFamily Family)
Print expected name of an allocator based on the deallocator's family derived from the DeallocExpr.
static void printExpectedDeallocName (raw_ostream &os, AllocationFamily Family)
Print expected name of a deallocator based on the allocator's family.
static bool isReleased (SymbolRef Sym, CheckerContext &C)
Check if the memory associated with this symbol was released.
static ProgramStateRef MallocUpdateRefState (CheckerContext &C, const Expr *E, ProgramStateRef State, AllocationFamily Family, std::optional< SVal > RetVal=std::nullopt)
Update the RefState to reflect the new memory allocation.
static bool isStandardNew (const FunctionDecl *FD)
static bool isStandardNew (const CallEvent &Call)
static bool isStandardDelete (const FunctionDecl *FD)
static bool isStandardDelete (const CallEvent &Call)
template
static bool isStandardNewDelete (const T &FD)
Tells if the callee is one of the builtin new/delete operators, including placement operators and other standard overloads.
static bool isStandardRealloc (const CallEvent &Call)
static bool isGRealloc (const CallEvent &Call)
static bool isFromStdNamespace (const CallEvent &Call)
static QualType getDeepPointeeType (QualType T)
static bool hasNonTrivialConstructorCall (const CXXNewExpr *NE)
static bool isKnownDeallocObjCMethodName (const ObjCMethodCall &Call)
static std::optional< bool > getFreeWhenDoneArg (const ObjCMethodCall &Call)
static bool didPreviousFreeFail (ProgramStateRef State, SymbolRef Sym, SymbolRef &RetStatusSymbol)
Checks if the previous call to free on the given symbol failed - if free failed, returns true.
static void printOwnershipTakesList (raw_ostream &os, CheckerContext &C, const Expr *E)
static bool checkIfNewOrNewArrayFamily (const RefState *RS)
static SymbolRef findFailedReallocSymbol (ProgramStateRef currState, ProgramStateRef prevState)
static bool isReferenceCountingPointerDestructor (const CXXDestructorDecl *DD)
ProgramStateRef clang::ento::allocation_state::markReleased (ProgramStateRef State, SymbolRef Sym, const Expr *Origin)

CASE

| #define CASE | ( | | ID | ) | case ID: OS << #ID; break; | | ------------ | - | | --------------------------------------------------------- | - | --------------------------------------------------------------------------------- |

CHECK_FN

Value:

const;

Represents an abstract call to a function or method along a particular path.

Definition at line 418 of file MallocChecker.cpp.

REGISTER_CHECKER

| #define REGISTER_CHECKER | ( | | name | ) | | ------------------------- | - | | ---- | - |

Value:

MallocChecker *checker = mgr.getChecker(); \

checker->ChecksEnabled[MallocChecker::CK_##name] = true; \

checker->CheckNames[MallocChecker::CK_##name] = \

} \

\

bool ento::shouldRegister##name(const CheckerManager &mgr) { return true; }

CheckerNameRef getCurrentCheckerName() const

Definition at line 3931 of file MallocChecker.cpp.

checkIfNewOrNewArrayFamily()

static bool checkIfNewOrNewArrayFamily ( const RefState * RS) static

didPreviousFreeFail()

findFailedReallocSymbol()

getDeepPointeeType()

getFreeWhenDoneArg()

hasNonTrivialConstructorCall()

static bool hasNonTrivialConstructorCall ( const CXXNewExpr * NE) static

isFromStdNamespace()

isGRealloc()

isKnownDeallocObjCMethodName()

isReferenceCountingPointerDestructor()

isReleased()

isStandardDelete() [1/2]

isStandardDelete() [2/2]

isStandardNew() [1/2]

isStandardNew() [2/2]

isStandardNewDelete()

template

static bool isStandardNewDelete ( const T & FD) static

isStandardRealloc()

MallocUpdateRefState()

Update the RefState to reflect the new memory allocation.

The optional RetVal parameter specifies the newly allocated pointer value; if unspecified, the value of expression E is used.

Definition at line 1941 of file MallocChecker.cpp.

References clang::C, and E.

printExpectedAllocName()

static void printExpectedAllocName ( raw_ostream & os, AllocationFamily Family ) static

Print expected name of an allocator based on the deallocator's family derived from the DeallocExpr.

Definition at line 2086 of file MallocChecker.cpp.

printExpectedDeallocName()

static void printExpectedDeallocName ( raw_ostream & os, AllocationFamily Family ) static

Print expected name of a deallocator based on the allocator's family.

Definition at line 2113 of file MallocChecker.cpp.

printMemFnName()

printOwnershipTakesList()

static void printOwnershipTakesList ( raw_ostream & os, CheckerContext & C, const Expr * E ) static