diff options
-rw-r--r-- | include/clang/Analysis/PathSensitive/BugReporter.h | 22 | ||||
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 2 |
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) { |