summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-18 20:54:29 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-18 20:54:29 +0000
commit31484b24773f7c020884268faaa770143bc216c6 (patch)
tree900d0226033dcecfe56bb1115b64a31184ab9b2f /clang/lib/Analysis/BugReporter.cpp
parentc072b820cf3148bbddb1baaedbac713075171886 (diff)
downloadbcm5719-llvm-31484b24773f7c020884268faaa770143bc216c6.tar.gz
bcm5719-llvm-31484b24773f7c020884268faaa770143bc216c6.zip
Generalize caching mechanism for bugs reports. Now individual BugTypes
can decide the policy on how to cache related bugs. This allows us to properly to handle warning about multiple leaks in the same location in the ref count checker (not yet done). llvm-svn: 49918
Diffstat (limited to 'clang/lib/Analysis/BugReporter.cpp')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index e74295c3113..e69c5a6d3ff 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -357,12 +357,14 @@ void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
}
}
-bool BugReporter::IsCached(ExplodedNode<ValueState>* N) {
+bool BugTypeCacheLocation::isCached(BugReport& R) {
+
+ ExplodedNode<ValueState>* N = R.getEndNode();
if (!N)
return false;
-
- // HACK: Cache the location of the error. Don't emit the same
+
+ // 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.
@@ -371,14 +373,13 @@ bool BugReporter::IsCached(ExplodedNode<ValueState>* N) {
if (CachedErrors.count(p))
return true;
- CachedErrors.insert(p);
-
+ CachedErrors.insert(p);
return false;
}
void BugReporter::EmitWarning(BugReport& R) {
- if (IsCached(R.getEndNode()))
+ if (R.getBugType().isCached(R))
return;
PathDiagnostic D(R.getName());
OpenPOWER on IntegriCloud