Added simple hack to reduce redundant warnings from the checker:

Cache the location of the error.  Don't emit the same
warning for the same error type that occurs at the same program
location but along a different path.
      


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47727 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRSimpleVals.cpp b/Analysis/GRSimpleVals.cpp
index 8b5e3c8..366ffb7 100644
--- a/Analysis/GRSimpleVals.cpp
+++ b/Analysis/GRSimpleVals.cpp
@@ -32,6 +32,8 @@
   
   bool isFirst = true;
   unsigned ErrorDiag;
+  llvm::SmallPtrSet<void*,10> CachedErrors;
+  
   
   for (; I != E; ++I) {
   
@@ -39,6 +41,18 @@
       isFirst = false;    
       ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning, msg);
     }
+    else {
+      
+      // HACK: Cache the location of the error.  Don't emit the same
+      // warning for the same error type that occurs at the same program
+      // location but along a different path.
+      void* p = (*I)->getLocation().getRawData();
+
+      if (CachedErrors.count(p))
+        continue;
+      
+      CachedErrors.insert(p);
+    }
   
     const PostStmt& L = cast<PostStmt>((*I)->getLocation());
     Expr* Exp = cast<Expr>(L.getStmt());