summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-03-13 13:52:54 +0000
committerAlexey Samsonov <samsonov@google.com>2014-03-13 13:52:54 +0000
commit063eb3fa2de0b1ba93b253a57e57a5a4358a33a2 (patch)
tree1a2f1bb8fd84e6948feecf9e907c0cebfd3e6935 /llvm/lib/Object/MachOObjectFile.cpp
parentcbc68521b3fbb0a6d8ca3e2cc6bff2772145ba32 (diff)
downloadbcm5719-llvm-063eb3fa2de0b1ba93b253a57e57a5a4358a33a2.tar.gz
bcm5719-llvm-063eb3fa2de0b1ba93b253a57e57a5a4358a33a2.zip
[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 llvm-svn: 203799
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 5dd9e5596b3..fb8a2146790 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -313,16 +313,16 @@ static void printRelocationTargetName(const MachOObjectFile *O,
// If we couldn't find a symbol that this relocation refers to, try
// to find a section beginning instead.
- for (section_iterator SI = O->section_begin(), SE = O->section_end();
- SI != SE; ++SI) {
+ for (const SectionRef &Section : O->sections()) {
error_code ec;
uint64_t Addr;
StringRef Name;
- if ((ec = SI->getAddress(Addr)))
+ if ((ec = Section.getAddress(Addr)))
report_fatal_error(ec.message());
- if (Addr != Val) continue;
- if ((ec = SI->getName(Name)))
+ if (Addr != Val)
+ continue;
+ if ((ec = Section.getName(Name)))
report_fatal_error(ec.message());
fmt << Name;
return;
OpenPOWER on IntegriCloud