[lld] r210082 - Use range-based for loop.

Rui Ueyama ruiu at google.com
Tue Jun 3 00:27:49 PDT 2014


Author: ruiu
Date: Tue Jun  3 02:27:49 2014
New Revision: 210082

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

Modified:
    lld/trunk/include/lld/ReaderWriter/LinkerScript.h

Modified: lld/trunk/include/lld/ReaderWriter/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/LinkerScript.h?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/LinkerScript.h (original)
+++ lld/trunk/include/lld/ReaderWriter/LinkerScript.h Tue Jun  3 02:27:49 2014
@@ -107,10 +107,12 @@ public:
 
   void dump(raw_ostream &os) const override {
     os << "OUTPUT_FORMAT(";
-    for (auto fb = _formats.begin(), fe = _formats.end(); fb != fe; ++fb) {
-      if (fb != _formats.begin())
+    bool first = true;
+    for (StringRef format : _formats) {
+      if (!first)
         os << ",";
-      os << *fb;
+      first = false;
+      os << format;
     }
     os << ")\n";
   }
@@ -166,8 +168,7 @@ public:
     for (const Path &path : getPaths()) {
       if (!first)
         os << " ";
-      else
-        first = false;
+      first = false;
       if (path._asNeeded)
         os << "AS_NEEDED(";
       os << path._path;





More information about the llvm-commits mailing list