#include "clang/AST/ExprCXX.h"
#include "clang/AST/ParentMap.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.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 "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
usingnamespaceclang;
usingnamespaceento;
namespace {
class CallAndMessageChecker
: public Checker<check::PreObjCMessage, check::ObjCMessageNil,
check::PreCall> { … };
}
void CallAndMessageChecker::emitBadCall(BugType *BT, CheckerContext &C,
const Expr *BadE) { … }
static void describeUninitializedArgumentInCall(const CallEvent &Call,
int ArgumentNumber,
llvm::raw_svector_ostream &Os) { … }
bool CallAndMessageChecker::uninitRefOrPointer(
CheckerContext &C, SVal V, SourceRange ArgRange, const Expr *ArgEx,
std::unique_ptr<BugType> &BT, const ParmVarDecl *ParamDecl, const char *BD,
int ArgumentNumber) const { … }
namespace {
class FindUninitializedField { … };
}
bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C,
SVal V,
SourceRange ArgRange,
const Expr *ArgEx,
int ArgumentNumber,
bool CheckUninitFields,
const CallEvent &Call,
std::unique_ptr<BugType> &BT,
const ParmVarDecl *ParamDecl
) const { … }
ProgramStateRef CallAndMessageChecker::checkFunctionPointerCall(
const CallExpr *CE, CheckerContext &C, ProgramStateRef State) const { … }
ProgramStateRef CallAndMessageChecker::checkParameterCount(
const CallEvent &Call, CheckerContext &C, ProgramStateRef State) const { … }
ProgramStateRef CallAndMessageChecker::checkCXXMethodCall(
const CXXInstanceCall *CC, CheckerContext &C, ProgramStateRef State) const { … }
ProgramStateRef
CallAndMessageChecker::checkCXXDeallocation(const CXXDeallocatorCall *DC,
CheckerContext &C,
ProgramStateRef State) const { … }
ProgramStateRef CallAndMessageChecker::checkArgInitializedness(
const CallEvent &Call, CheckerContext &C, ProgramStateRef State) const { … }
void CallAndMessageChecker::checkPreCall(const CallEvent &Call,
CheckerContext &C) const { … }
void CallAndMessageChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
CheckerContext &C) const { … }
void CallAndMessageChecker::checkObjCMessageNil(const ObjCMethodCall &msg,
CheckerContext &C) const { … }
void CallAndMessageChecker::emitNilReceiverBug(CheckerContext &C,
const ObjCMethodCall &msg,
ExplodedNode *N) const { … }
static bool supportsNilWithFloatRet(const llvm::Triple &triple) { … }
void CallAndMessageChecker::HandleNilReceiver(CheckerContext &C,
ProgramStateRef state,
const ObjCMethodCall &Msg) const { … }
void ento::registerCallAndMessageModeling(CheckerManager &mgr) { … }
bool ento::shouldRegisterCallAndMessageModeling(const CheckerManager &mgr) { … }
void ento::registerCallAndMessageChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterCallAndMessageChecker(const CheckerManager &mgr) { … }