diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-03-20 18:01:57 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-03-20 18:01:57 +0000 |
commit | 1b431023814196f87515a540ebcb9e9f1a9176a1 (patch) | |
tree | 0cf0e0e7b13757991e1a3429b77dbca80baff79c /lib/Checker/BugReporterVisitors.cpp | |
parent | 6493b8153a56cbff9f89c1a53f04b6af424b383a (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/BugReporterVisitors.cpp')
-rw-r--r-- | lib/Checker/BugReporterVisitors.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Checker/BugReporterVisitors.cpp b/lib/Checker/BugReporterVisitors.cpp index 6cf41b14dc..7104f91d88 100644 --- a/lib/Checker/BugReporterVisitors.cpp +++ b/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) { |