summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/BugReporterVisitors.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
commit92713e7ec33e4d7c3ef61b9fb2768a26eb811765 (patch)
tree125ef67fd37e37dc5df409377659230bc2924d3a /clang/lib/Checker/BugReporterVisitors.cpp
parent496766cb56f24920293d7b48b302c3b96be26743 (diff)
downloadbcm5719-llvm-92713e7ec33e4d7c3ef61b9fb2768a26eb811765.tar.gz
bcm5719-llvm-92713e7ec33e4d7c3ef61b9fb2768a26eb811765.zip
Check if a BugReporterVisitor has already been added to a BugReporterContext.
This avoids redundant diagnostics. llvm-svn: 99063
Diffstat (limited to 'clang/lib/Checker/BugReporterVisitors.cpp')
-rw-r--r--clang/lib/Checker/BugReporterVisitors.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/Checker/BugReporterVisitors.cpp b/clang/lib/Checker/BugReporterVisitors.cpp
index 6cf41b14dc5..7104f91d882 100644
--- a/clang/lib/Checker/BugReporterVisitors.cpp
+++ b/clang/lib/Checker/BugReporterVisitors.cpp
@@ -92,6 +92,13 @@ public:
FindLastStoreBRVisitor(SVal v, const MemRegion *r)
: R(r), V(v), satisfied(false), StoreSite(0) {}
+ virtual void Profile(llvm::FoldingSetNodeID &ID) const {
+ static int tag = 0;
+ ID.AddPointer(&tag);
+ ID.AddPointer(R);
+ ID.Add(V);
+ }
+
PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN,
BugReporterContext& BRC) {
@@ -129,8 +136,8 @@ public:
return NULL;
satisfied = true;
- std::string sbuf;
- llvm::raw_string_ostream os(sbuf);
+ llvm::SmallString<256> sbuf;
+ llvm::raw_svector_ostream os(sbuf);
if (const PostStmt *PS = N->getLocationAs<PostStmt>()) {
if (const DeclStmt *DS = PS->getStmtAs<DeclStmt>()) {
@@ -239,6 +246,13 @@ public:
TrackConstraintBRVisitor(DefinedSVal constraint, bool assumption)
: Constraint(constraint), Assumption(assumption), isSatisfied(false) {}
+ void Profile(llvm::FoldingSetNodeID &ID) const {
+ static int tag = 0;
+ ID.AddPointer(&tag);
+ ID.AddBoolean(Assumption);
+ ID.Add(Constraint);
+ }
+
PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN,
BugReporterContext& BRC) {
OpenPOWER on IntegriCloud