aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-11 18:40:29 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-11 18:40:29 +0000
commit5e55cda64f4452fa65d83f66390c7126a8b248bb (patch)
treed0d8ac420f466464477df71d3b417badcf23427c
parent405cbb48a7bfb2c45e5b3b028666ebdfb208f872 (diff)
Added "RangedBugReport".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49551 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/BugReporter.h22
-rw-r--r--lib/Analysis/BugReporter.cpp2
2 files changed, 24 insertions, 0 deletions
diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h
index adb18ab42a..e3596b8a12 100644
--- a/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -68,6 +68,28 @@ public:
ASTContext& Ctx);
};
+ class RangedBugReport : public BugReport {
+ std::vector<SourceRange> Ranges;
+public:
+ RangedBugReport(const BugType& D) : BugReport(D) {}
+ virtual ~RangedBugReport();
+
+ void addRange(SourceRange R) { Ranges.push_back(R); }
+
+ virtual void getRanges(const SourceRange*& beg,
+ const SourceRange*& end) const {
+
+ if (Ranges.empty()) {
+ beg = NULL;
+ end = NULL;
+ }
+ else {
+ beg = &Ranges[0];
+ end = beg + Ranges.size();
+ }
+ }
+};
+
class BugReporter {
llvm::SmallPtrSet<void*,10> CachedErrors;
Diagnostic& Diag;
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 0f7b235944..148d2582dc 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -28,6 +28,8 @@ using namespace clang;
BugReporter::~BugReporter() {}
BugType::~BugType() {}
BugReport::~BugReport() {}
+RangedBugReport::~RangedBugReport() {}
+
ExplodedGraph<ValueState>& BugReporter::getGraph() { return Eng.getGraph(); }
static inline Stmt* GetStmt(const ProgramPoint& P) {