Use range-based loops when handling OPT_print_search_dirs.

llvm-svn: 240476
This commit is contained in:
Douglas Katzman 2015-06-23 22:43:50 +00:00
parent 51af160f4c
commit 51fe7bf227
1 changed files with 11 additions and 11 deletions

View File

@ -740,25 +740,25 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
if (C.getArgs().hasArg(options::OPT_print_search_dirs)) {
llvm::outs() << "programs: =";
for (ToolChain::path_list::const_iterator it = TC.getProgramPaths().begin(),
ie = TC.getProgramPaths().end(); it != ie; ++it) {
if (it != TC.getProgramPaths().begin())
llvm::outs() << ':';
llvm::outs() << *it;
bool separator = false;
for (const std::string &Path : TC.getProgramPaths()) {
if (separator) llvm::outs() << ':';
llvm::outs() << Path;
separator = true;
}
llvm::outs() << "\n";
llvm::outs() << "libraries: =" << ResourceDir;
StringRef sysroot = C.getSysRoot();
for (ToolChain::path_list::const_iterator it = TC.getFilePaths().begin(),
ie = TC.getFilePaths().end(); it != ie; ++it) {
for (const std::string &Path : TC.getFilePaths()) {
// Always print a separator. ResourceDir was the first item shown.
llvm::outs() << ':';
const char *path = it->c_str();
if (path[0] == '=')
llvm::outs() << sysroot << path + 1;
// Interpretation of leading '=' is needed only for NetBSD.
if (Path[0] == '=')
llvm::outs() << sysroot << (Path.c_str() + 1);
else
llvm::outs() << path;
llvm::outs() << Path;
}
llvm::outs() << "\n";
return false;