[cfe-commits] r47727 - /cfe/trunk/Analysis/GRSimpleVals.cpp
Ted Kremenek
kremenek at apple.com
Thu Feb 28 12:38:16 PST 2008
Author: kremenek
Date: Thu Feb 28 14:38:16 2008
New Revision: 47727
URL: http://llvm.org/viewvc/llvm-project?rev=47727&view=rev
Log:
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.
Modified:
cfe/trunk/Analysis/GRSimpleVals.cpp
Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47727&r1=47726&r2=47727&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Thu Feb 28 14:38:16 2008
@@ -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());
More information about the cfe-commits
mailing list