clang API Documentation
#include "ClangSACheckers.h"
#include "SelectorExtras.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/StmtObjC.h"
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/raw_ostream.h"
Go to the source code of this file.
enum CFNumberType |
Definition at line 359 of file BasicObjCFoundationChecks.cpp.
enum FoundationClass |
FC_None | |
FC_NSArray | |
FC_NSDictionary | |
FC_NSEnumerator | |
FC_NSNull | |
FC_NSOrderedSet | |
FC_NSSet | |
FC_NSString |
Definition at line 58 of file BasicObjCFoundationChecks.cpp.
static bool alreadyExecutedAtLeastOneLoopIteration | ( | const ExplodedNode * | N, |
const ObjCForCollectionStmt * | FCS | ||
) | [static] |
If the fist block edge is a back edge, we are reentering the loop.
Definition at line 988 of file BasicObjCFoundationChecks.cpp.
References clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getLocation(), P, clang::ento::ExplodedNode::pred_begin(), and clang::ento::ExplodedNode::pred_end().
static ProgramStateRef assumeCollectionNonEmpty | ( | CheckerContext & | C, |
ProgramStateRef | State, | ||
SymbolRef | CollectionS, | ||
bool | Assumption | ||
) | [static] |
Returns NULL state if the collection is known to contain elements (or is known not to contain elements if the Assumption parameter is false.)
Definition at line 944 of file BasicObjCFoundationChecks.cpp.
References clang::BO_GT, clang::ento::SValBuilder::evalBinOp(), clang::ento::SVal::getAs(), clang::ento::SValBuilder::getConditionType(), clang::ento::CheckerContext::getSValBuilder(), clang::ento::SValBuilder::makeIntVal(), and State.
Referenced by assumeCollectionNonEmpty().
static ProgramStateRef assumeCollectionNonEmpty | ( | CheckerContext & | C, |
ProgramStateRef | State, | ||
const ObjCForCollectionStmt * | FCS, | ||
bool | Assumption | ||
) | [static] |
Definition at line 975 of file BasicObjCFoundationChecks.cpp.
References assumeCollectionNonEmpty(), clang::ObjCForCollectionStmt::getCollection(), and clang::ento::CheckerContext::getLocationContext().
static ProgramStateRef checkCollectionNonNil | ( | CheckerContext & | C, |
ProgramStateRef | State, | ||
const ObjCForCollectionStmt * | FCS | ||
) | [static] |
Assumes that the collection is non-nil.
If the collection is known to be nil, returns NULL to indicate an infeasible path.
Definition at line 885 of file BasicObjCFoundationChecks.cpp.
References clang::ento::SVal::getAs(), clang::ObjCForCollectionStmt::getCollection(), clang::ento::CheckerContext::getSVal(), and State.
static ProgramStateRef checkElementNonNil | ( | CheckerContext & | C, |
ProgramStateRef | State, | ||
const ObjCForCollectionStmt * | FCS | ||
) | [static] |
Assumes that the collection elements are non-nil.
This only applies if the collection is one of those known not to contain nil values.
Definition at line 910 of file BasicObjCFoundationChecks.cpp.
References clang::ento::SVal::castAs(), clang::ObjCForCollectionStmt::getCollection(), clang::ObjCForCollectionStmt::getElement(), clang::VarDecl::getInit(), clang::ento::CheckerContext::getLocationContext(), clang::Expr::getType(), isKnownNonNilCollectionType(), and State.
static FoundationClass findKnownClass | ( | const ObjCInterfaceDecl * | ID, |
bool | IncludeSuperclasses = true |
||
) | [static] |
Definition at line 69 of file BasicObjCFoundationChecks.cpp.
References FC_None, FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSNull, FC_NSOrderedSet, FC_NSSet, FC_NSString, clang::NamedDecl::getIdentifier(), clang::IdentifierInfo::getName(), and clang::ObjCInterfaceDecl::getSuperClass().
Referenced by getMethodReceiverIfKnownImmutable(), and isKnownNonNilCollectionType().
static Optional<uint64_t> GetCFNumberSize | ( | ASTContext & | Ctx, |
uint64_t | i | ||
) | [static] |
Definition at line 378 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, and clang::ASTContext::ShortTy.
static SymbolRef getMethodReceiverIfKnownImmutable | ( | const CallEvent * | Call | ) | [static] |
Definition at line 1091 of file BasicObjCFoundationChecks.cpp.
References FC_None, FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSNull, FC_NSOrderedSet, FC_NSSet, FC_NSString, findKnownClass(), clang::ento::SVal::getAsSymbol(), clang::ObjCMethodDecl::getClassInterface(), clang::ObjCMethodCall::getDecl(), clang::Decl::getDeclContext(), clang::ObjCMethodCall::getOriginExpr(), clang::ObjCMessageExpr::getReceiverInterface(), and clang::ObjCMethodCall::getReceiverSVal().
static StringRef GetReceiverInterfaceName | ( | const ObjCMethodCall & | msg | ) | [static] |
Definition at line 52 of file BasicObjCFoundationChecks.cpp.
References clang::ObjCMethodCall::getReceiverInterface().
static bool isKnownNonNilCollectionType | ( | QualType | T | ) | [static] |
Definition at line 860 of file BasicObjCFoundationChecks.cpp.
References FC_NSArray, FC_NSDictionary, FC_NSEnumerator, FC_NSOrderedSet, FC_NSSet, findKnownClass(), clang::Type::getAs(), and clang::ObjCObjectPointerType::getInterfaceDecl().
Referenced by checkElementNonNil().