[analyzer] Rename AttrNonNullChecker -> NonNullParamChecker

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176755 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
index 26dbb7f..fdb6bbb 100644
--- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -384,7 +384,7 @@
     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 60d1e3e..b7df10e 100644
--- a/lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ b/lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -7,7 +7,6 @@
   AnalyzerStatsChecker.cpp
   ArrayBoundChecker.cpp
   ArrayBoundCheckerV2.cpp
-  AttrNonNullChecker.cpp
   BasicObjCFoundationChecks.cpp
   BoolAssignmentChecker.cpp
   BuiltinFunctionChecker.cpp
@@ -43,6 +42,7 @@
   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 5170b7a..bbcf9aa 100644
--- a/lib/StaticAnalyzer/Checkers/Checkers.td
+++ b/lib/StaticAnalyzer/Checkers/Checkers.td
@@ -60,9 +60,9 @@
   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
similarity index 89%
rename from lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
rename to lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
index d159341..273a7a3 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 ento;
 
 namespace {
-class AttrNonNullChecker
+class NonNullParamChecker
   : public Checker< check::PreCall > {
   mutable OwningPtr<BugType> BTAttrNonNull;
   mutable OwningPtr<BugType> BTNullRefArg;
@@ -39,7 +42,7 @@
 };
 } // 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 @@
   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 @@
   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 @@
 
 }
 
-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 a7fbd66..bb22c25 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -1193,7 +1193,7 @@
   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;
 }