Use range loop.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 30 Jun 2015 19:13:25 +0000 (19:13 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 30 Jun 2015 19:13:25 +0000 (19:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241104 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-readobj/ARMEHABIPrinter.h

index 1da0095c7b30e3005ef1daa1b38d21a5913063b2..6ee3c0d44497e7b482ebe5a235c87c4f825d816f 100644 (file)
@@ -526,20 +526,18 @@ void PrinterContext<ET>::PrintUnwindInformation() const {
   DictScope UI(SW, "UnwindInformation");
 
   int SectionIndex = 0;
-  for (Elf_Shdr_iterator SI = ELF->section_begin(), SE = ELF->section_end();
-       SI != SE; ++SI, ++SectionIndex) {
-    if (SI->sh_type == ELF::SHT_ARM_EXIDX) {
-      const Elf_Shdr *IT = &(*SI);
-
+  for (const Elf_Shdr &Sec : ELF->sections()) {
+    if (Sec.sh_type == ELF::SHT_ARM_EXIDX) {
       DictScope UIT(SW, "UnwindIndexTable");
 
       SW.printNumber("SectionIndex", SectionIndex);
-      if (ErrorOr<StringRef> SectionName = ELF->getSectionName(IT))
+      if (ErrorOr<StringRef> SectionName = ELF->getSectionName(&Sec))
         SW.printString("SectionName", *SectionName);
-      SW.printHex("SectionOffset", IT->sh_offset);
+      SW.printHex("SectionOffset", Sec.sh_offset);
 
-      PrintIndexTable(SectionIndex, IT);
+      PrintIndexTable(SectionIndex, &Sec);
     }
+    ++SectionIndex;
   }
 }
 }