summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/Analysis/GRSimpleVals.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/Analysis/GRSimpleVals.cpp b/clang/Analysis/GRSimpleVals.cpp
index 8b5e3c85a97..366ffb70c66 100644
--- a/clang/Analysis/GRSimpleVals.cpp
+++ b/clang/Analysis/GRSimpleVals.cpp
@@ -32,6 +32,8 @@ static void EmitWarning(Diagnostic& Diag, SourceManager& SrcMgr,
bool isFirst = true;
unsigned ErrorDiag;
+ llvm::SmallPtrSet<void*,10> CachedErrors;
+
for (; I != E; ++I) {
@@ -39,6 +41,18 @@ static void EmitWarning(Diagnostic& Diag, SourceManager& SrcMgr,
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());
OpenPOWER on IntegriCloud