diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-12-29 19:01:36 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-12-29 19:01:36 +0000 |
commit | 688b6bc2f4e759b1e45512da9d46114c7c55c387 (patch) | |
tree | ac1d0537e8eb95d5d7cb297726cabecfbd097de4 /clang/lib/Driver/Driver.cpp | |
parent | 550d900048fe018c2f51bdd993626c38a8351113 (diff) | |
download | bcm5719-llvm-688b6bc2f4e759b1e45512da9d46114c7c55c387.tar.gz bcm5719-llvm-688b6bc2f4e759b1e45512da9d46114c7c55c387.zip |
Driver: convert a number of loops to range based
Iterate over the arguments via range based for loops rather than iterators and
explicitly dereferencing them. NFC.
llvm-svn: 224944
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 80bc94c14c5..0b5b86e8099 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -128,9 +128,7 @@ InputArgList *Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings) { << Args->getArgString(MissingArgIndex) << MissingArgCount; // Check for unsupported options. - for (ArgList::const_iterator it = Args->begin(), ie = Args->end(); - it != ie; ++it) { - Arg *A = *it; + for (const Arg *A : *Args) { if (A->getOption().hasFlag(options::Unsupported)) { Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args); continue; @@ -211,10 +209,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { DerivedArgList *DAL = new DerivedArgList(Args); bool HasNostdlib = Args.hasArg(options::OPT_nostdlib); - for (ArgList::const_iterator it = Args.begin(), - ie = Args.end(); it != ie; ++it) { - const Arg *A = *it; - + for (Arg *A : Args) { // Unfortunately, we have to parse some forwarding options (-Xassembler, // -Xlinker, -Xpreprocessor) because we either integrate their functionality // (assembler and preprocessor), or bypass a previous driver ('collect2'). @@ -280,7 +275,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { continue; } - DAL->append(*it); + DAL->append(A); } // Add a default value of -mlinker-version=, if one was given and the user @@ -474,9 +469,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C, // Don't attempt to generate preprocessed files if multiple -arch options are // used, unless they're all duplicates. llvm::StringSet<> ArchNames; - for (ArgList::const_iterator it = C.getArgs().begin(), ie = C.getArgs().end(); - it != ie; ++it) { - Arg *A = *it; + for (const Arg *A : C.getArgs()) { if (A->getOption().matches(options::OPT_arch)) { StringRef ArchName = A->getValue(); ArchNames.insert(ArchName); @@ -876,10 +869,7 @@ void Driver::BuildUniversalActions(const ToolChain &TC, // be handled once (in the order seen). llvm::StringSet<> ArchNames; SmallVector<const char *, 4> Archs; - for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); - it != ie; ++it) { - Arg *A = *it; - + for (Arg *A : Args) { if (A->getOption().matches(options::OPT_arch)) { // Validate the option here; we don't save the type here because its // particular spelling may participate in other driver choices. @@ -1027,10 +1017,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not allowed"); } - for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); - it != ie; ++it) { - Arg *A = *it; - + for (Arg *A : Args) { if (A->getOption().getKind() == Option::InputClass) { const char *Value = A->getValue(); types::ID Ty = types::TY_INVALID; @@ -1408,19 +1395,12 @@ void Driver::BuildJobs(Compilation &C) const { // Collect the list of architectures. llvm::StringSet<> ArchNames; - if (C.getDefaultToolChain().getTriple().isOSBinFormatMachO()) { - for (ArgList::const_iterator it = C.getArgs().begin(), ie = C.getArgs().end(); - it != ie; ++it) { - Arg *A = *it; + if (C.getDefaultToolChain().getTriple().isOSBinFormatMachO()) + for (const Arg *A : C.getArgs()) if (A->getOption().matches(options::OPT_arch)) ArchNames.insert(A->getValue()); - } - } - - for (ActionList::const_iterator it = C.getActions().begin(), - ie = C.getActions().end(); it != ie; ++it) { - Action *A = *it; + for (Action *A : C.getActions()) { // If we are linking an image for multiple archs then the linker wants // -arch_multiple and -final_output <final image name>. Unfortunately, this // doesn't fit in cleanly because we have to pass this information down. @@ -1456,10 +1436,7 @@ void Driver::BuildJobs(Compilation &C) const { // Claim --driver-mode, it was handled earlier. (void) C.getArgs().hasArg(options::OPT_driver_mode); - for (ArgList::const_iterator it = C.getArgs().begin(), ie = C.getArgs().end(); - it != ie; ++it) { - Arg *A = *it; - + for (Arg *A : C.getArgs()) { // FIXME: It would be nice to be able to send the argument to the // DiagnosticsEngine, so that extra values, position, and so on could be // printed. |