From: Ted Kremenek Date: Wed, 11 Mar 2009 01:40:35 +0000 (+0000) Subject: Add some iterators to BugReporter. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3aa1ab27c14d16c853ccb61f17a4a75d8e366806;p=clang Add some iterators to BugReporter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66621 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h index 0350f91a2d..85430e366e 100644 --- a/include/clang/Analysis/PathSensitive/BugReporter.h +++ b/include/clang/Analysis/PathSensitive/BugReporter.h @@ -141,9 +141,23 @@ public: BugReport* operator*() const { return *impl; } BugReport* operator->() const { return *impl; } }; + + class const_iterator { + std::list::const_iterator impl; + public: + const_iterator(std::list::const_iterator i) : impl(i) {} + const_iterator& operator++() { ++impl; return *this; } + bool operator==(const const_iterator& I) const { return I.impl == impl; } + bool operator!=(const const_iterator& I) const { return I.impl != impl; } + const BugReport* operator*() const { return *impl; } + const BugReport* operator->() const { return *impl; } + }; iterator begin() { return iterator(Reports.begin()); } iterator end() { return iterator(Reports.end()); } + + const_iterator begin() const { return const_iterator(Reports.begin()); } + const_iterator end() const { return const_iterator(Reports.end()); } }; class BugType { @@ -162,6 +176,14 @@ public: virtual void FlushReports(BugReporter& BR); void AddReport(BugReport* BR); + + typedef llvm::FoldingSet::iterator iterator; + iterator begin() { return EQClasses.begin(); } + iterator end() { return EQClasses.end(); } + + typedef llvm::FoldingSet::const_iterator const_iterator; + const_iterator begin() const { return EQClasses.begin(); } + const_iterator end() const { return EQClasses.end(); } }; //===----------------------------------------------------------------------===// @@ -244,6 +266,10 @@ public: return D.getPathDiagnosticClient(); } + typedef BugTypesTy::iterator iterator; + iterator begin() { return BugTypes.begin(); } + iterator end() { return BugTypes.end(); } + ASTContext& getContext() { return D.getContext(); } SourceManager& getSourceManager() { return D.getSourceManager(); }