Some of those loops were pretty monstrous.
llvm-svn: 212616
return false;
}
- for (auto it = parsedArgs->filtered_begin(OPT_UNKNOWN),
- ie = parsedArgs->filtered_end(); it != ie; ++it) {
+ for (auto unknownArg : parsedArgs->filtered(OPT_UNKNOWN)) {
diagnostics << "warning: ignoring unknown argument: "
- << (*it)->getAsString(*parsedArgs) << "\n";
+ << unknownArg->getAsString(*parsedArgs) << "\n";
}
// Figure out output kind ( -dylib, -r, -bundle, -preload, or -static )
}
// Handle -mllvm
- for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_mllvm),
- ie = parsedArgs->filtered_end();
- it != ie; ++it) {
- ctx.appendLLVMOption((*it)->getValue());
+ for (auto &llvmArg : parsedArgs->filtered(OPT_mllvm)) {
+ ctx.appendLLVMOption(llvmArg->getValue());
}
// Handle -print_atoms a
std::unique_ptr<InputGraph> inputGraph(new InputGraph());
// Handle input files
- for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_INPUT),
- ie = parsedArgs->filtered_end();
- it != ie; ++it) {
+ for (auto &inputFile : parsedArgs->filtered(OPT_INPUT)) {
inputGraph->addInputElement(std::unique_ptr<InputElement>(
- new MachOFileNode(ctx, (*it)->getValue(), globalWholeArchive)));
+ new MachOFileNode(ctx, inputFile->getValue(), globalWholeArchive)));
}
if (!inputGraph->size()) {
bool _outputOptionSet = false;
// Ignore unknown arguments.
- for (auto it = parsedArgs->filtered_begin(OPT_UNKNOWN),
- ie = parsedArgs->filtered_end();
- it != ie; ++it)
- diagnostics << "warning: ignoring unknown argument: " << (*it)->getValue()
- << "\n";
+ for (auto unknownArg : parsedArgs->filtered(OPT_UNKNOWN))
+ diagnostics << "warning: ignoring unknown argument: "
+ << unknownArg->getValue() << "\n";
// Set sys root path.
if (llvm::opt::Arg *sysRootPath = parsedArgs->getLastArg(OPT_sysroot))
ctx->setSysroot(sysRootPath->getValue());
// Add all search paths.
- for (auto it = parsedArgs->filtered_begin(OPT_L),
- ie = parsedArgs->filtered_end();
- it != ie; ++it)
- ctx->addSearchPath((*it)->getValue());
+ for (auto libDir : parsedArgs->filtered(OPT_L))
+ ctx->addSearchPath(libDir->getValue());
if (!parsedArgs->hasArg(OPT_nostdlib))
addPlatformSearchDirs(*ctx, triple, baseTriple);
// Show warning for unknown arguments. In .drectve section, unknown options
// starting with "-?" are silently ignored. This is a COFF's feature to embed a
// new linker option to an object file while keeping backward compatibility.
- for (auto it = parsedArgs->filtered_begin(OPT_UNKNOWN),
- ie = parsedArgs->filtered_end(); it != ie; ++it) {
- StringRef arg = (*it)->getSpelling();
+ for (auto unknownArg : parsedArgs->filtered(OPT_UNKNOWN)) {
+ StringRef arg = unknownArg->getSpelling();
if (isReadingDirectiveSection && arg.startswith("-?"))
continue;
diag << "warning: ignoring unknown argument: " << arg << "\n";
// Handle /nodefaultlib:<lib>. The same option without argument is handled in
// the following for loop.
- for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_nodefaultlib),
- ie = parsedArgs->filtered_end();
- it != ie; ++it) {
- ctx.addNoDefaultLib((*it)->getValue());
+ for (auto nodeDefaultLib : parsedArgs->filtered(OPT_nodefaultlib)) {
+ ctx.addNoDefaultLib(nodeDefaultLib->getValue());
}
// Handle /defaultlib. Argument of the option is added to the input file list
// unless it's blacklisted by /nodefaultlib.
std::vector<StringRef> defaultLibs;
- for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_defaultlib),
- ie = parsedArgs->filtered_end();
- it != ie; ++it) {
- defaultLibs.push_back((*it)->getValue());
+ for (auto defaultLib : parsedArgs->filtered(OPT_defaultlib)) {
+ defaultLibs.push_back(defaultLib->getValue());
}
std::vector<StringRef> inputFiles;