aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-20 18:01:57 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-20 18:01:57 +0000
commit1b431023814196f87515a540ebcb9e9f1a9176a1 (patch)
tree0cf0e0e7b13757991e1a3429b77dbca80baff79c /lib/Checker/BugReporter.cpp
parent6493b8153a56cbff9f89c1a53f04b6af424b383a (diff)
Check if a BugReporterVisitor has already been added to a BugReporterContext.
This avoids redundant diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/BugReporter.cpp')
-rw-r--r--lib/Checker/BugReporter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Checker/BugReporter.cpp b/lib/Checker/BugReporter.cpp
index 0cf593b260..f26d16120e 100644
--- a/lib/Checker/BugReporter.cpp
+++ b/lib/Checker/BugReporter.cpp
@@ -36,6 +36,21 @@ BugReporterContext::~BugReporterContext() {
if ((*I)->isOwnedByReporterContext()) delete *I;
}
+void BugReporterContext::addVisitor(BugReporterVisitor* visitor) {
+ if (!visitor)
+ return;
+
+ llvm::FoldingSetNodeID ID;
+ visitor->Profile(ID);
+ void *InsertPos;
+
+ if (CallbacksSet.FindNodeOrInsertPos(ID, InsertPos))
+ return;
+
+ CallbacksSet.InsertNode(visitor, InsertPos);
+ Callbacks = F.Add(visitor, Callbacks);
+}
+
//===----------------------------------------------------------------------===//
// Helper routines for walking the ExplodedGraph and fetching statements.
//===----------------------------------------------------------------------===//