Added "RangedBugReport".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49551 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h
index adb18ab..e3596b8 100644
--- a/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -68,6 +68,28 @@
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 0f7b235..148d258 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -28,6 +28,8 @@
BugReporter::~BugReporter() {}
BugType::~BugType() {}
BugReport::~BugReport() {}
+RangedBugReport::~RangedBugReport() {}
+
ExplodedGraph<ValueState>& BugReporter::getGraph() { return Eng.getGraph(); }
static inline Stmt* GetStmt(const ProgramPoint& P) {