forked from OSchip/llvm-project
[analyzer] Rename AttrNonNullChecker -> NonNullParamChecker
llvm-svn: 176755
This commit is contained in:
parent
cdbca7ae77
commit
ef89339986
|
@ -384,7 +384,7 @@ void CFRetainReleaseChecker::checkPreStmt(const CallExpr *CE,
|
|||
return;
|
||||
|
||||
// FIXME: The rest of this just checks that the argument is non-null.
|
||||
// It should probably be refactored and combined with AttrNonNullChecker.
|
||||
// It should probably be refactored and combined with NonNullParamChecker.
|
||||
|
||||
// Get the argument's value.
|
||||
const Expr *Arg = CE->getArg(0);
|
||||
|
|
|
@ -7,7 +7,6 @@ add_clang_library(clangStaticAnalyzerCheckers
|
|||
AnalyzerStatsChecker.cpp
|
||||
ArrayBoundChecker.cpp
|
||||
ArrayBoundCheckerV2.cpp
|
||||
AttrNonNullChecker.cpp
|
||||
BasicObjCFoundationChecks.cpp
|
||||
BoolAssignmentChecker.cpp
|
||||
BuiltinFunctionChecker.cpp
|
||||
|
@ -43,6 +42,7 @@ add_clang_library(clangStaticAnalyzerCheckers
|
|||
MallocSizeofChecker.cpp
|
||||
NSAutoreleasePoolChecker.cpp
|
||||
NSErrorChecker.cpp
|
||||
NonNullParamChecker.cpp
|
||||
NoReturnFunctionChecker.cpp
|
||||
ObjCAtSyncChecker.cpp
|
||||
ObjCContainersASTChecker.cpp
|
||||
|
|
|
@ -60,9 +60,9 @@ def CallAndMessageChecker : Checker<"CallAndMessage">,
|
|||
HelpText<"Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)">,
|
||||
DescFile<"CallAndMessageChecker.cpp">;
|
||||
|
||||
def AttrNonNullChecker : Checker<"AttributeNonNull">,
|
||||
HelpText<"Check for null pointers passed as arguments to a function whose arguments are marked with the 'nonnull' attribute">,
|
||||
DescFile<"AttrNonNullChecker.cpp">;
|
||||
def NonNullParamChecker : Checker<"NonNullParamChecker">,
|
||||
HelpText<"Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute">,
|
||||
DescFile<"NonNullParamChecker.cpp">;
|
||||
|
||||
def VLASizeChecker : Checker<"VLASize">,
|
||||
HelpText<"Check for declarations of VLA of undefined or zero size">,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- AttrNonNullChecker.h - Undefined arguments checker ----*- C++ -*--===//
|
||||
//===--- NonNullParamChecker.cpp - Undefined arguments checker -*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,8 +7,11 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This defines AttrNonNullChecker, a builtin check in ExprEngine that
|
||||
// performs checks for arguments declared to have nonnull attribute.
|
||||
// This defines NonNullParamChecker, which checks for arguments expected not to
|
||||
// be null due to:
|
||||
// - the corresponding parameters being declared to have nonnull attribute
|
||||
// - the corresponding parameters being references; since the call would form
|
||||
// a reference to a null pointer
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -24,7 +27,7 @@ using namespace clang;
|
|||
using namespace ento;
|
||||
|
||||
namespace {
|
||||
class AttrNonNullChecker
|
||||
class NonNullParamChecker
|
||||
: public Checker< check::PreCall > {
|
||||
mutable OwningPtr<BugType> BTAttrNonNull;
|
||||
mutable OwningPtr<BugType> BTNullRefArg;
|
||||
|
@ -39,7 +42,7 @@ public:
|
|||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
void AttrNonNullChecker::checkPreCall(const CallEvent &Call,
|
||||
void NonNullParamChecker::checkPreCall(const CallEvent &Call,
|
||||
CheckerContext &C) const {
|
||||
const Decl *FD = Call.getDecl();
|
||||
if (!FD)
|
||||
|
@ -146,7 +149,7 @@ void AttrNonNullChecker::checkPreCall(const CallEvent &Call,
|
|||
C.addTransition(state);
|
||||
}
|
||||
|
||||
BugReport *AttrNonNullChecker::genReportNullAttrNonNull(
|
||||
BugReport *NonNullParamChecker::genReportNullAttrNonNull(
|
||||
const ExplodedNode *ErrorNode, const Expr *ArgE) const {
|
||||
// Lazily allocate the BugType object if it hasn't already been
|
||||
// created. Ownership is transferred to the BugReporter object once
|
||||
|
@ -165,7 +168,7 @@ BugReport *AttrNonNullChecker::genReportNullAttrNonNull(
|
|||
return R;
|
||||
}
|
||||
|
||||
BugReport *AttrNonNullChecker::genReportReferenceToNullPointer(
|
||||
BugReport *NonNullParamChecker::genReportReferenceToNullPointer(
|
||||
const ExplodedNode *ErrorNode, const Expr *ArgE) const {
|
||||
if (!BTNullRefArg)
|
||||
BTNullRefArg.reset(new BuiltinBug("Dereference of null pointer"));
|
||||
|
@ -185,6 +188,6 @@ BugReport *AttrNonNullChecker::genReportReferenceToNullPointer(
|
|||
|
||||
}
|
||||
|
||||
void ento::registerAttrNonNullChecker(CheckerManager &mgr) {
|
||||
mgr.registerChecker<AttrNonNullChecker>();
|
||||
void ento::registerNonNullParamChecker(CheckerManager &mgr) {
|
||||
mgr.registerChecker<NonNullParamChecker>();
|
||||
}
|
|
@ -1193,7 +1193,7 @@ static void RDar8424269_B(RDar8424269_A *p, unsigned char *RDar8424269_D,
|
|||
tmp2 = tmp2t[2];
|
||||
}
|
||||
|
||||
// <rdar://problem/8642434> - Handle transparent unions with the AttrNonNullChecker.
|
||||
// <rdar://problem/8642434> - Handle transparent unions with the NonNullParamChecker.
|
||||
typedef union {
|
||||
struct rdar_8642434_typeA *_dq;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue