Hooked up the dead-store checker to the BugReporter interface.  Now dead-store
warnings are emitted as part of the warnings registered by GRSimpleVals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49658 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index e5a31bf..717f5b8 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -68,7 +68,9 @@
     SourceRange R;
   public:
     
-    Report(NilArg& Desc, ObjCMessageExpr* ME, unsigned Arg) : BugReport(Desc) {
+    Report(NilArg& Desc, ExplodedNode<ValueState>* N, 
+           ObjCMessageExpr* ME, unsigned Arg)
+      : BugReport(Desc, N) {
       
       Expr* E = ME->getArg(Arg);
       R = E->getSourceRange();
@@ -90,22 +92,6 @@
       B = &R;
       E = B+1;
     }
-    
-    virtual PathDiagnosticPiece* getEndPath(ASTContext& Ctx,
-                                            ExplodedNode<ValueState> *N) const {
-      
-      Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
-      
-      if (!S)
-        return NULL;
-      
-      FullSourceLoc L(S->getLocStart(), Ctx.getSourceManager());
-      PathDiagnosticPiece* P = new PathDiagnosticPiece(L, s);
-      
-      P->addRange(R);
-      
-      return P;
-    }
   };  
 };
 
@@ -115,7 +101,7 @@
   ASTContext &Ctx;
   ValueStateManager* VMgr;
   
-  typedef std::vector<std::pair<NodeTy*,BugReport*> > ErrorsTy;
+  typedef std::vector<BugReport*> ErrorsTy;
   ErrorsTy Errors;
       
   RVal GetRVal(ValueState* St, Expr* E) { return VMgr->GetRVal(St, E); }
@@ -134,7 +120,7 @@
       
   virtual ~BasicObjCFoundationChecks() {
     for (ErrorsTy::iterator I = Errors.begin(), E = Errors.end(); I!=E; ++I)
-      delete I->second;    
+      delete *I;    
   }
   
   virtual bool Audit(ExplodedNode<ValueState>* N);
@@ -143,12 +129,12 @@
   
 private:
   
-  void AddError(NodeTy* N, BugReport* R) {
-    Errors.push_back(std::make_pair(N, R));
+  void AddError(BugReport* R) {
+    Errors.push_back(R);
   }
   
   void WarnNilArg(NodeTy* N, ObjCMessageExpr* ME, unsigned Arg) {
-    AddError(N, new NilArg::Report(Desc, ME, Arg));
+    AddError(new NilArg::Report(Desc, N, ME, Arg));
   }
 };
   
@@ -203,9 +189,8 @@
 
 void BasicObjCFoundationChecks::EmitWarnings(BugReporter& BR) {    
                  
-  for (ErrorsTy::iterator I=Errors.begin(), E=Errors.end(); I!=E; ++I)
-    
-    BR.EmitPathWarning(*I->second, I->first);
+  for (ErrorsTy::iterator I=Errors.begin(), E=Errors.end(); I!=E; ++I)    
+    BR.EmitPathWarning(**I);
 }
 
 bool BasicObjCFoundationChecks::CheckNilArg(NodeTy* N, unsigned Arg) {