[C++11] Introduce ObjectFile::sections().

Summary:
This adds ObjectFile::section_iterator_range, that allows to write
range-based for-loops running over all sections of a given file.
Several files from lib/ are converted to the new interface. Similar fixes
should be applied to a variety of llvm-* tools.

Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3069

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-03-13 13:52:54 +00:00
parent f8909fa140
commit b920dfe02b
5 changed files with 63 additions and 55 deletions

View File

@ -289,6 +289,11 @@ public:
virtual section_iterator section_begin() const = 0;
virtual section_iterator section_end() const = 0;
typedef iterator_range<section_iterator> section_iterator_range;
section_iterator_range sections() const {
return section_iterator_range(section_begin(), section_end());
}
virtual library_iterator needed_library_begin() const = 0;
virtual library_iterator needed_library_end() const = 0;