]> granicus.if.org Git - clang/commitdiff
Driver: use range based for loop
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 16 Sep 2014 03:48:32 +0000 (03:48 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 16 Sep 2014 03:48:32 +0000 (03:48 +0000)
Use a couple more range based for loops.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217857 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index 8068bbea78dc4841e3a34846acf09d7c52c84e39..6cf6c01dcadfb7665ab13d897fc0aaffcfd43107 100644 (file)
@@ -1863,10 +1863,9 @@ std::string Driver::GetProgramPath(const char *Name,
   std::string TargetSpecificExecutable(DefaultTargetTriple + "-" + Name);
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when looking for program paths.
-  for (Driver::prefix_list::const_iterator it = PrefixDirs.begin(),
-       ie = PrefixDirs.end(); it != ie; ++it) {
-    if (llvm::sys::fs::is_directory(*it)) {
-      SmallString<128> P(*it);
+  for (const auto &PrefixDir : PrefixDirs) {
+    if (llvm::sys::fs::is_directory(PrefixDir)) {
+      SmallString<128> P(PrefixDir);
       llvm::sys::path::append(P, TargetSpecificExecutable);
       if (llvm::sys::fs::can_execute(Twine(P)))
         return P.str();
@@ -1875,16 +1874,15 @@ std::string Driver::GetProgramPath(const char *Name,
       if (llvm::sys::fs::can_execute(Twine(P)))
         return P.str();
     } else {
-      SmallString<128> P(*it + Name);
+      SmallString<128> P(PrefixDir + Name);
       if (llvm::sys::fs::can_execute(Twine(P)))
         return P.str();
     }
   }
 
   const ToolChain::path_list &List = TC.getProgramPaths();
-  for (ToolChain::path_list::const_iterator
-         it = List.begin(), ie = List.end(); it != ie; ++it) {
-    SmallString<128> P(*it);
+  for (const auto &Path : List) {
+    SmallString<128> P(Path);
     llvm::sys::path::append(P, TargetSpecificExecutable);
     if (llvm::sys::fs::can_execute(Twine(P)))
       return P.str();