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

Go to the source code of this file.

Enumerations
enum FoundationClass { FC_None, FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSNull, FC_NSOrderedSet, FC_NSSet, FC_NSString }
enum CFNumberType { kCFNumberSInt8Type = 1 , kCFNumberSInt16Type = 2 , kCFNumberSInt32Type = 3 , kCFNumberSInt64Type = 4 , kCFNumberFloat32Type = 5 , kCFNumberFloat64Type = 6 , kCFNumberCharType = 7 , kCFNumberShortType = 8 , kCFNumberIntType = 9 , kCFNumberLongType = 10 , kCFNumberLongLongType = 11 , kCFNumberFloatType = 12 , kCFNumberDoubleType = 13 , kCFNumberCFIndexType = 14 , kCFNumberNSIntegerType = 15 , kCFNumberCGFloatType = 16 }
Functions
static StringRef GetReceiverInterfaceName (const ObjCMethodCall &msg)
static FoundationClass findKnownClass (const ObjCInterfaceDecl *ID, bool IncludeSuperclasses=true)
static std::optional< uint64_t > GetCFNumberSize (ASTContext &Ctx, uint64_t i)
static bool isKnownNonNilCollectionType (QualType T)
static ProgramStateRef checkCollectionNonNil (CheckerContext &C, ProgramStateRef State, const ObjCForCollectionStmt *FCS)
Assumes that the collection is non-nil.
static ProgramStateRef checkElementNonNil (CheckerContext &C, ProgramStateRef State, const ObjCForCollectionStmt *FCS)
Assumes that the collection elements are non-nil.
static ProgramStateRef assumeCollectionNonEmpty (CheckerContext &C, ProgramStateRef State, SymbolRef CollectionS, bool Assumption)
Returns NULL state if the collection is known to contain elements (or is known not to contain elements if the Assumption parameter is false.)
static ProgramStateRef assumeCollectionNonEmpty (CheckerContext &C, ProgramStateRef State, const ObjCForCollectionStmt *FCS, bool Assumption)
static bool alreadyExecutedAtLeastOneLoopIteration (const ExplodedNode *N, const ObjCForCollectionStmt *FCS)
If the fist block edge is a back edge, we are reentering the loop.
static SymbolRef getMethodReceiverIfKnownImmutable (const CallEvent *Call)

CFNumberType

Enumerator
kCFNumberSInt8Type
kCFNumberSInt16Type
kCFNumberSInt32Type
kCFNumberSInt64Type
kCFNumberFloat32Type
kCFNumberFloat64Type
kCFNumberCharType
kCFNumberShortType
kCFNumberIntType
kCFNumberLongType
kCFNumberLongLongType
kCFNumberFloatType
kCFNumberDoubleType
kCFNumberCFIndexType
kCFNumberNSIntegerType
kCFNumberCGFloatType

Definition at line 363 of file BasicObjCFoundationChecks.cpp.

FoundationClass

Enumerator
FC_None
FC_NSArray
FC_NSDictionary
FC_NSEnumerator
FC_NSNull
FC_NSOrderedSet
FC_NSSet
FC_NSString

Definition at line 61 of file BasicObjCFoundationChecks.cpp.

alreadyExecutedAtLeastOneLoopIteration()

assumeCollectionNonEmpty() [1/2]

assumeCollectionNonEmpty() [2/2]

checkCollectionNonNil()

checkElementNonNil()

findKnownClass()

Definition at line 72 of file BasicObjCFoundationChecks.cpp.

References FC_None, FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSNull, FC_NSOrderedSet, FC_NSSet, FC_NSString, and findKnownClass().

Referenced by findKnownClass(), getMethodReceiverIfKnownImmutable(), and isKnownNonNilCollectionType().

GetCFNumberSize()

static std::optional< uint64_t > GetCFNumberSize ( ASTContext & Ctx, uint64_t i ) static

Definition at line 382 of file BasicObjCFoundationChecks.cpp.

References clang::ASTContext::CharTy, clang::ASTContext::DoubleTy, clang::ASTContext::FloatTy, clang::ASTContext::getTypeSize(), clang::ASTContext::IntTy, kCFNumberCFIndexType, kCFNumberCGFloatType, kCFNumberCharType, kCFNumberDoubleType, kCFNumberFloatType, kCFNumberIntType, kCFNumberLongLongType, kCFNumberLongType, kCFNumberNSIntegerType, kCFNumberShortType, clang::ASTContext::LongLongTy, clang::ASTContext::LongTy, clang::ASTContext::ShortTy, and clang::T.

getMethodReceiverIfKnownImmutable()

Definition at line 1057 of file BasicObjCFoundationChecks.cpp.

References clang::Call, FC_None, FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSNull, FC_NSOrderedSet, FC_NSSet, FC_NSString, findKnownClass(), clang::ObjCMethodDecl::getClassInterface(), and clang::Decl::getDeclContext().

GetReceiverInterfaceName()

static StringRef GetReceiverInterfaceName ( const ObjCMethodCall & msg) static

isKnownNonNilCollectionType()

static bool isKnownNonNilCollectionType ( QualType T) static