aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-03-09 03:23:14 +0000
committerAnna Zaks <ganna@apple.com>2013-03-09 03:23:14 +0000
commit80412c4e28c8247ad9c8d30d04c94938f01b21fb (patch)
treebcabe87cdcf7562d30268a2def4d4c83bd3caa90
parent6cc4e25e76981ae47019bc47911724eaaf2f9a3f (diff)
[analyzer] Rename AttrNonNullChecker -> NonNullParamChecker
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176755 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp2
-rw-r--r--lib/StaticAnalyzer/Checkers/CMakeLists.txt2
-rw-r--r--lib/StaticAnalyzer/Checkers/Checkers.td6
-rw-r--r--lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp (renamed from lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp)21
-rw-r--r--test/Analysis/misc-ps-region-store.m2
5 files changed, 18 insertions, 15 deletions
diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
index 26dbb7f250..fdb6bbbe52 100644
--- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -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);
diff --git a/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/lib/StaticAnalyzer/Checkers/CMakeLists.txt
index 60d1e3e834..b7df10e7ff 100644
--- a/lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ b/lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -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
diff --git a/lib/StaticAnalyzer/Checkers/Checkers.td b/lib/StaticAnalyzer/Checkers/Checkers.td
index 5170b7a149..bbcf9aa438 100644
--- a/lib/StaticAnalyzer/Checkers/Checkers.td
+++ b/lib/StaticAnalyzer/Checkers/Checkers.td
@@ -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">,
diff --git a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp b/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
index d1593419e8..273a7a3882 100644
--- a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
@@ -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>();
}
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index a7fbd66d68..bb22c25998 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -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;
}