forked from OSchip/llvm-project
rename UndefinedArgChecker to CallAndMessageChecker.
llvm-svn: 89735
This commit is contained in:
parent
da32375115
commit
72269ec8cb
|
@ -1,4 +1,4 @@
|
||||||
//===--- UndefinedArgChecker.h - Undefined arguments checker ----*- C++ -*--==//
|
//===--- CallAndMessageChecker.cpp ------------------------------*- C++ -*--==//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -7,8 +7,8 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This defines BadCallChecker, a builtin check in GRExprEngine that performs
|
// This defines CallAndMessageChecker, a builtin checker that checks for various
|
||||||
// checks for undefined arguments.
|
// errors of call and objc message expressions.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class VISIBILITY_HIDDEN UndefinedArgChecker
|
class VISIBILITY_HIDDEN CallAndMessageChecker
|
||||||
: public CheckerVisitor<UndefinedArgChecker> {
|
: public CheckerVisitor<CallAndMessageChecker> {
|
||||||
BugType *BT_call_null;
|
BugType *BT_call_null;
|
||||||
BugType *BT_call_undef;
|
BugType *BT_call_undef;
|
||||||
BugType *BT_call_arg;
|
BugType *BT_call_arg;
|
||||||
BugType *BT_msg_undef;
|
BugType *BT_msg_undef;
|
||||||
BugType *BT_msg_arg;
|
BugType *BT_msg_arg;
|
||||||
public:
|
public:
|
||||||
UndefinedArgChecker() :
|
CallAndMessageChecker() :
|
||||||
BT_call_null(0), BT_call_undef(0), BT_call_arg(0),
|
BT_call_null(0), BT_call_undef(0), BT_call_arg(0),
|
||||||
BT_msg_undef(0), BT_msg_arg(0) {}
|
BT_msg_undef(0), BT_msg_arg(0) {}
|
||||||
static void *getTag() {
|
static void *getTag() {
|
||||||
|
@ -41,11 +41,11 @@ private:
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
void clang::RegisterUndefinedArgChecker(GRExprEngine &Eng) {
|
void clang::RegisterCallAndMessageChecker(GRExprEngine &Eng) {
|
||||||
Eng.registerCheck(new UndefinedArgChecker());
|
Eng.registerCheck(new CallAndMessageChecker());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndefinedArgChecker::EmitBadCall(BugType *BT, CheckerContext &C,
|
void CallAndMessageChecker::EmitBadCall(BugType *BT, CheckerContext &C,
|
||||||
const CallExpr *CE) {
|
const CallExpr *CE) {
|
||||||
ExplodedNode *N = C.GenerateSink();
|
ExplodedNode *N = C.GenerateSink();
|
||||||
if (!N)
|
if (!N)
|
||||||
|
@ -57,7 +57,7 @@ void UndefinedArgChecker::EmitBadCall(BugType *BT, CheckerContext &C,
|
||||||
C.EmitReport(R);
|
C.EmitReport(R);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndefinedArgChecker::PreVisitCallExpr(CheckerContext &C,
|
void CallAndMessageChecker::PreVisitCallExpr(CheckerContext &C,
|
||||||
const CallExpr *CE){
|
const CallExpr *CE){
|
||||||
|
|
||||||
const Expr *Callee = CE->getCallee()->IgnoreParens();
|
const Expr *Callee = CE->getCallee()->IgnoreParens();
|
||||||
|
@ -97,7 +97,7 @@ void UndefinedArgChecker::PreVisitCallExpr(CheckerContext &C,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndefinedArgChecker::PreVisitObjCMessageExpr(CheckerContext &C,
|
void CallAndMessageChecker::PreVisitObjCMessageExpr(CheckerContext &C,
|
||||||
const ObjCMessageExpr *ME) {
|
const ObjCMessageExpr *ME) {
|
||||||
|
|
||||||
const GRState *state = C.getState();
|
const GRState *state = C.getState();
|
||||||
|
|
|
@ -226,7 +226,7 @@ void GRExprEngine::RegisterInternalChecks() {
|
||||||
// automatically. Note that the check itself is owned by the GRExprEngine
|
// automatically. Note that the check itself is owned by the GRExprEngine
|
||||||
// object.
|
// object.
|
||||||
RegisterAttrNonNullChecker(*this);
|
RegisterAttrNonNullChecker(*this);
|
||||||
RegisterUndefinedArgChecker(*this);
|
RegisterCallAndMessageChecker(*this);
|
||||||
RegisterDereferenceChecker(*this);
|
RegisterDereferenceChecker(*this);
|
||||||
RegisterVLASizeChecker(*this);
|
RegisterVLASizeChecker(*this);
|
||||||
RegisterDivZeroChecker(*this);
|
RegisterDivZeroChecker(*this);
|
||||||
|
|
|
@ -30,7 +30,7 @@ void RegisterPointerSubChecker(GRExprEngine &Eng);
|
||||||
void RegisterPointerArithChecker(GRExprEngine &Eng);
|
void RegisterPointerArithChecker(GRExprEngine &Eng);
|
||||||
void RegisterFixedAddressChecker(GRExprEngine &Eng);
|
void RegisterFixedAddressChecker(GRExprEngine &Eng);
|
||||||
void RegisterCastToStructChecker(GRExprEngine &Eng);
|
void RegisterCastToStructChecker(GRExprEngine &Eng);
|
||||||
void RegisterUndefinedArgChecker(GRExprEngine &Eng);
|
void RegisterCallAndMessageChecker(GRExprEngine &Eng);
|
||||||
void RegisterArrayBoundChecker(GRExprEngine &Eng);
|
void RegisterArrayBoundChecker(GRExprEngine &Eng);
|
||||||
void RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng);
|
void RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng);
|
||||||
void RegisterUndefinedAssignmentChecker(GRExprEngine &Eng);
|
void RegisterUndefinedAssignmentChecker(GRExprEngine &Eng);
|
||||||
|
|
Loading…
Reference in New Issue