r217857 - Driver: use range based for loop
Saleem Abdulrasool
compnerd at compnerd.org
Mon Sep 15 20:48:32 PDT 2014
Author: compnerd
Date: Mon Sep 15 22:48:32 2014
New Revision: 217857
URL: http://llvm.org/viewvc/llvm-project?rev=217857&view=rev
Log:
Driver: use range based for loop
Use a couple more range based for loops. NFC.
Modified:
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=217857&r1=217856&r2=217857&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Sep 15 22:48:32 2014
@@ -1863,10 +1863,9 @@ std::string Driver::GetProgramPath(const
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
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();
More information about the cfe-commits
mailing list