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/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 24e4cfa..eb31f84 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -89,7 +89,7 @@
       isSink |= (*I)->Audit(N, VMgr);
     
     // Next handle the auditors that accept only specific statements.
-    Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
+    const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
     void* key = reinterpret_cast<void*>((uintptr_t) S->getStmtClass());
     MapTy::iterator MI = M.find(key);
     if (MI != M.end()) {    
@@ -3096,9 +3096,8 @@
         break;
         
       default: {
-        if (isa<PostStmt>(Loc)) {
-          const PostStmt& L = cast<PostStmt>(Loc);        
-          Stmt* S = L.getStmt();
+        if (StmtPoint *L = dyn_cast<StmtPoint>(&Loc)) {
+          const Stmt* S = L->getStmt();
           SourceLocation SLoc = S->getLocStart();
 
           Out << S->getStmtClassName() << ' ' << (void*) S << ' ';        
@@ -3113,7 +3112,9 @@
               << "\\l";
           }
           
-          if (isa<PostLoad>(Loc))
+          if (isa<PreStmt>(Loc))
+            Out << "\\lPreStmt\\l;";          
+          else if (isa<PostLoad>(Loc))
             Out << "\\lPostLoad\\l;";
           else if (isa<PostStore>(Loc))
             Out << "\\lPostStore\\l";