[llvm] r260459 - [llvm-nm] Prefer range-based loop over explicit iterator.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 15:16:17 PST 2016


Author: davide
Date: Wed Feb 10 17:16:17 2016
New Revision: 260459

URL: http://llvm.org/viewvc/llvm-project?rev=260459&view=rev
Log:
[llvm-nm] Prefer range-based loop over explicit iterator.

Modified:
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=260459&r1=260458&r2=260459&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Wed Feb 10 17:16:17 2016
@@ -877,9 +877,8 @@ static char getNMTypeChar(SymbolicFile &
 // file or zero it is not present.
 static unsigned getNsectForSegSect(MachOObjectFile *Obj) {
   unsigned Nsect = 1;
-  for (section_iterator I = Obj->section_begin(), E = Obj->section_end();
-       I != E; ++I) {
-    DataRefImpl Ref = I->getRawDataRefImpl();
+  for (auto &S : Obj->sections()) {
+    DataRefImpl Ref = S.getRawDataRefImpl();
     StringRef SectionName;
     Obj->getSectionName(Ref, SectionName);
     StringRef SegmentName = Obj->getSectionFinalSegmentName(Ref);




More information about the llvm-commits mailing list