[llvm] r241104 - Use range loop.

Rafael Espindola rafael.espindola at gmail.com
Tue Jun 30 12:13:25 PDT 2015


Author: rafael
Date: Tue Jun 30 14:13:25 2015
New Revision: 241104

URL: http://llvm.org/viewvc/llvm-project?rev=241104&view=rev
Log:
Use range loop.

Modified:
    llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h

Modified: llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h?rev=241104&r1=241103&r2=241104&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h (original)
+++ llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h Tue Jun 30 14:13:25 2015
@@ -526,20 +526,18 @@ void PrinterContext<ET>::PrintUnwindInfo
   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;
   }
 }
 }





More information about the llvm-commits mailing list