aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Checker
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-12-04 01:12:15 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-12-04 01:12:15 +0000
commit640ccf071076e684713cc3c3276bb51982bff607 (patch)
tree5944378a29eade657092b63164c37d1e3b118ab4 /include/clang/Checker
parentae3038c5e8bfce47337e83aeb253256633fbb701 (diff)
Minor refactoring; have BugReport::getRanges return a pair of iterator, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Checker')
-rw-r--r--include/clang/Checker/BugReporter/BugReporter.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/include/clang/Checker/BugReporter/BugReporter.h b/include/clang/Checker/BugReporter/BugReporter.h
index 16d01ff834..031693d6d7 100644
--- a/include/clang/Checker/BugReporter/BugReporter.h
+++ b/include/clang/Checker/BugReporter/BugReporter.h
@@ -62,7 +62,7 @@ protected:
std::string ShortDescription;
std::string Description;
const ExplodedNode *ErrorNode;
- SourceRange R;
+ mutable SourceRange R;
protected:
friend class BugReporter;
@@ -126,8 +126,10 @@ public:
/// This location is used by clients rendering diagnostics.
virtual SourceLocation getLocation() const;
+ typedef const SourceRange *ranges_iterator;
+
/// getRanges - Returns the source ranges associated with this bug.
- virtual void getRanges(const SourceRange*& beg, const SourceRange*& end);
+ virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const;
virtual PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
const ExplodedNode* PrevN,
@@ -192,7 +194,7 @@ public:
// FIXME: Collapse this with the default BugReport class.
class RangedBugReport : public BugReport {
- std::vector<SourceRange> Ranges;
+ llvm::SmallVector<SourceRange, 4> Ranges;
public:
RangedBugReport(BugType& D, llvm::StringRef description,
ExplodedNode *errornode)
@@ -210,17 +212,8 @@ public:
Ranges.push_back(R);
}
- // FIXME: Move this out of line.
- void getRanges(const SourceRange*& beg, const SourceRange*& end) {
-
- if (Ranges.empty()) {
- beg = NULL;
- end = NULL;
- }
- else {
- beg = &Ranges[0];
- end = beg + Ranges.size();
- }
+ virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const {
+ return std::make_pair(Ranges.begin(), Ranges.end());
}
};