Use range-based for loop.
authorRui Ueyama <ruiu@google.com>
Tue, 3 Jun 2014 07:27:49 +0000 (07:27 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 3 Jun 2014 07:27:49 +0000 (07:27 +0000)
llvm-svn: 210082

lld/include/lld/ReaderWriter/LinkerScript.h

index 25e7cf5..b46adc8 100644 (file)
@@ -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;