summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-03-04 00:03:09 +0000
committerRui Ueyama <ruiu@google.com>2014-03-04 00:03:09 +0000
commit839b3c76d37f16571bb20c14d8b820531aee2c65 (patch)
treefef1751bc64925df3a749b6da7b5cfd500cb8db7 /tools/llvm-objdump
parent824dfb1c5690ad1494572c95909c0d9dc27338c8 (diff)
downloadllvm-839b3c76d37f16571bb20c14d8b820531aee2c65.tar.gz
llvm-839b3c76d37f16571bb20c14d8b820531aee2c65.tar.bz2
llvm-839b3c76d37f16571bb20c14d8b820531aee2c65.tar.xz
llvm-objdump: Use range-based-for loop and fix format.
This is a small cleanup before making a bit larger change to this function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r--tools/llvm-objdump/COFFDump.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp
index 0b7f64d39e..424ae7c71d 100644
--- a/tools/llvm-objdump/COFFDump.cpp
+++ b/tools/llvm-objdump/COFFDump.cpp
@@ -414,28 +414,31 @@ void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) {
ArrayRef<RuntimeFunction> RFs(
reinterpret_cast<const RuntimeFunction *>(Contents.data()),
Contents.size() / sizeof(RuntimeFunction));
- for (const RuntimeFunction *I = RFs.begin(), *E = RFs.end(); I < E; ++I) {
- const uint64_t SectionOffset = std::distance(RFs.begin(), I)
- * sizeof(RuntimeFunction);
+ for (const RuntimeFunction &RF : RFs) {
+ const uint64_t SectionOffset =
+ std::distance(RFs.begin(), &RF) * sizeof(RuntimeFunction);
outs() << "Function Table:\n";
outs() << " Start Address: ";
- printCOFFSymbolAddress(outs(), Rels, SectionOffset +
- /*offsetof(RuntimeFunction, StartAddress)*/ 0,
- I->StartAddress);
+ printCOFFSymbolAddress(outs(), Rels,
+ SectionOffset +
+ /*offsetof(RuntimeFunction, StartAddress)*/ 0,
+ RF.StartAddress);
outs() << "\n";
outs() << " End Address: ";
- printCOFFSymbolAddress(outs(), Rels, SectionOffset +
- /*offsetof(RuntimeFunction, EndAddress)*/ 4,
- I->EndAddress);
+ printCOFFSymbolAddress(outs(), Rels,
+ SectionOffset +
+ /*offsetof(RuntimeFunction, EndAddress)*/ 4,
+ RF.EndAddress);
outs() << "\n";
outs() << " Unwind Info Address: ";
- printCOFFSymbolAddress(outs(), Rels, SectionOffset +
- /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
- I->UnwindInfoOffset);
+ printCOFFSymbolAddress(
+ outs(), Rels, SectionOffset +
+ /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
+ RF.UnwindInfoOffset);
outs() << "\n";
ArrayRef<uint8_t> XContents;
@@ -445,8 +448,9 @@ void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) {
XContents, UnwindInfoOffset))) continue;
if (XContents.empty()) continue;
- UnwindInfoOffset += I->UnwindInfoOffset;
- if (UnwindInfoOffset > XContents.size()) continue;
+ UnwindInfoOffset += RF.UnwindInfoOffset;
+ if (UnwindInfoOffset > XContents.size())
+ continue;
const Win64EH::UnwindInfo *UI =
reinterpret_cast<const Win64EH::UnwindInfo *>