From 5e55cda64f4452fa65d83f66390c7126a8b248bb Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 11 Apr 2008 18:40:29 +0000 Subject: [PATCH] Added "RangedBugReport". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49551 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Analysis/PathSensitive/BugReporter.h | 22 +++++++++++++++++++ lib/Analysis/BugReporter.cpp | 2 ++ 2 files changed, 24 insertions(+) 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 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 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& BugReporter::getGraph() { return Eng.getGraph(); } static inline Stmt* GetStmt(const ProgramPoint& P) { -- 2.50.1