Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.

Educate GRExprEngine::VisitGraph() about 'PreStmt'.

Mark the constructor of 'PostStmt' to be explicit, preventing implicit
conversions and the selection of the wrong 'generateNode' method in
GRStmtNodeBuilder.

Constify a bunch of arguments, which falls out of the changes to ProgramPoint.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76809 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index 8bbf94c..7620377 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -63,10 +63,10 @@
   ASTContext &Ctx;
       
   bool isNSString(const ObjCInterfaceType *T, const char* suffix);
-  bool AuditNSString(NodeTy* N, ObjCMessageExpr* ME);
+  bool AuditNSString(NodeTy* N, const ObjCMessageExpr* ME);
       
-  void Warn(NodeTy* N, Expr* E, const std::string& s);  
-  void WarnNilArg(NodeTy* N, Expr* E);
+  void Warn(NodeTy* N, const Expr* E, const std::string& s);  
+  void WarnNilArg(NodeTy* N, const Expr* E);
   
   bool CheckNilArg(NodeTy* N, unsigned Arg);
 
@@ -77,7 +77,7 @@
   bool Audit(ExplodedNode<GRState>* N, GRStateManager&);
   
 private:  
-  void WarnNilArg(NodeTy* N, ObjCMessageExpr* ME, unsigned Arg) {    
+  void WarnNilArg(NodeTy* N, const ObjCMessageExpr* ME, unsigned Arg) {    
     std::string sbuf;
     llvm::raw_string_ostream os(sbuf);
     os << "Argument to '" << GetReceiverNameType(ME) << "' method '"
@@ -106,7 +106,7 @@
 bool BasicObjCFoundationChecks::Audit(ExplodedNode<GRState>* N,
                                       GRStateManager&) {
   
-  ObjCMessageExpr* ME =
+  const ObjCMessageExpr* ME =
     cast<ObjCMessageExpr>(cast<PostStmt>(N->getLocation()).getStmt());
 
   const ObjCInterfaceType *ReceiverType = GetReceiverType(ME);
@@ -140,10 +140,10 @@
 //===----------------------------------------------------------------------===//
 
 bool BasicObjCFoundationChecks::CheckNilArg(NodeTy* N, unsigned Arg) {
-  ObjCMessageExpr* ME =
+  const ObjCMessageExpr* ME =
     cast<ObjCMessageExpr>(cast<PostStmt>(N->getLocation()).getStmt());
   
-  Expr * E = ME->getArg(Arg);
+  const Expr * E = ME->getArg(Arg);
   
   if (isNil(N->getState()->getSVal(E))) {
     WarnNilArg(N, ME, Arg);
@@ -163,7 +163,7 @@
 }
 
 bool BasicObjCFoundationChecks::AuditNSString(NodeTy* N, 
-                                              ObjCMessageExpr* ME) {
+                                              const ObjCMessageExpr* ME) {
   
   Selector S = ME->getSelector();
   
@@ -257,7 +257,7 @@
   bool Audit(ExplodedNode<GRState>* N, GRStateManager&);
   
 private:
-  void AddError(const TypedRegion* R, Expr* Ex, ExplodedNode<GRState> *N,
+  void AddError(const TypedRegion* R, const Expr* Ex, ExplodedNode<GRState> *N,
                 uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);  
 };
 } // end anonymous namespace
@@ -356,8 +356,9 @@
 #endif
 
 bool AuditCFNumberCreate::Audit(ExplodedNode<GRState>* N,GRStateManager&){  
-  CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
-  Expr* Callee = CE->getCallee();  
+  const CallExpr* CE =
+    cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
+  const Expr* Callee = CE->getCallee();  
   SVal CallV = N->getState()->getSVal(Callee);  
   const FunctionDecl* FD = CallV.getAsFunctionDecl();
 
@@ -423,7 +424,7 @@
   return SourceSize < TargetSize;
 }
 
-void AuditCFNumberCreate::AddError(const TypedRegion* R, Expr* Ex,
+void AuditCFNumberCreate::AddError(const TypedRegion* R, const Expr* Ex,
                                    ExplodedNode<GRState> *N,
                                    uint64_t SourceSize, uint64_t TargetSize,
                                    uint64_t NumberKind) {
@@ -486,7 +487,7 @@
 
 
 bool AuditCFRetainRelease::Audit(ExplodedNode<GRState>* N, GRStateManager&) {
-  CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
+  const CallExpr* CE = cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
   
   // If the CallExpr doesn't have exactly 1 argument just give up checking.
   if (CE->getNumArgs() != 1)