aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/BugReporter.h
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
commit95cc1bae89ac68626d6f4d389e189ce1ef3aa7f6 (patch)
tree329013af8c1456752d42f1f2fe908533a7fa629b /include/clang/Analysis/PathSensitive/BugReporter.h
parentb0533965f1b4db020692e3b23ca7b3bc15bf5897 (diff)
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/BugReporter.h')
-rw-r--r--include/clang/Analysis/PathSensitive/BugReporter.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h
index f2f2e03166..325e1a750f 100644
--- a/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -32,6 +32,7 @@ class BugReporter;
class GRExprEngine;
class ValueState;
class Stmt;
+class BugReport;
class BugType {
public:
@@ -43,17 +44,29 @@ public:
virtual void EmitWarnings(BugReporter& BR) {}
virtual void GetErrorNodes(std::vector<ExplodedNode<ValueState>*>& Nodes) {}
+
+ virtual bool isCached(BugReport& R) = 0;
+};
+
+class BugTypeCacheLocation : public BugType {
+ llvm::SmallPtrSet<void*,10> CachedErrors;
+public:
+ BugTypeCacheLocation() {}
+ virtual ~BugTypeCacheLocation() {}
+ virtual bool isCached(BugReport& R);
};
+
class BugReport {
- const BugType& Desc;
+ BugType& Desc;
ExplodedNode<ValueState> *N;
public:
- BugReport(const BugType& D, ExplodedNode<ValueState> *n) : Desc(D), N(n) {}
+ BugReport(BugType& D, ExplodedNode<ValueState> *n) : Desc(D), N(n) {}
virtual ~BugReport();
const BugType& getBugType() const { return Desc; }
+ BugType& getBugType() { return Desc; }
ExplodedNode<ValueState>* getEndNode() const { return N; }
@@ -82,7 +95,7 @@ public:
class RangedBugReport : public BugReport {
std::vector<SourceRange> Ranges;
public:
- RangedBugReport(const BugType& D, ExplodedNode<ValueState> *n)
+ RangedBugReport(BugType& D, ExplodedNode<ValueState> *n)
: BugReport(D, n) {}
virtual ~RangedBugReport();
@@ -104,7 +117,6 @@ public:
};
class BugReporter {
- llvm::SmallPtrSet<void*,10> CachedErrors;
Diagnostic& Diag;
PathDiagnosticClient* PD;
ASTContext& Ctx;
@@ -130,10 +142,6 @@ public:
CFG& getCFG() { return getGraph().getCFG(); }
void EmitWarning(BugReport& R);
-
- void clearCache() { CachedErrors.clear(); }
-
- bool IsCached(ExplodedNode<ValueState>* N);
void GeneratePathDiagnostic(PathDiagnostic& PD, BugReport& R);
};