diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-18 01:14:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-18 01:14:43 +0000 |
commit | 862c833452a4e2cfbfa204fa2b7b40d042998aa6 (patch) | |
tree | df70214e51c63417ef5901f95d00e19954a5802b | |
parent | a0f32072cd808c09524e8d469d3f7d4f866329c4 (diff) |
Cleanup: use range-based for rather than separate calls to begin and end.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295524 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Driver/Driver.cpp | 17 | ||||
-rw-r--r-- | tools/driver/cc1as_main.cpp | 10 |
2 files changed, 12 insertions, 15 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 0dcab7c0c6..b8ae7e4c31 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1456,16 +1456,15 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, ? types::TY_C : types::TY_CXX; - arg_iterator it = - Args.filtered_begin(options::OPT__SLASH_TC, options::OPT__SLASH_TP); - const arg_iterator ie = Args.filtered_end(); - Arg *Previous = *it++; + Arg *Previous = nullptr; bool ShowNote = false; - while (it != ie) { - Diag(clang::diag::warn_drv_overriding_flag_option) - << Previous->getSpelling() << (*it)->getSpelling(); - Previous = *it++; - ShowNote = true; + for (Arg *A : Args.filtered(options::OPT__SLASH_TC, options::OPT__SLASH_TP)) { + if (Previous) { + Diag(clang::diag::warn_drv_overriding_flag_option) + << Previous->getSpelling() << A->getSpelling(); + ShowNote = true; + } + Previous = A; } if (ShowNote) Diag(clang::diag::note_drv_t_option_is_global); diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 263751346b..2fa8edb81a 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -212,13 +212,11 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; - for (arg_iterator it = Args.filtered_begin(OPT_INPUT), - ie = Args.filtered_end(); - it != ie; ++it, First = false) { - const Arg *A = it; - if (First) + for (const Arg *A : Args.filtered(OPT_INPUT)) { + if (First) { Opts.InputFile = A->getValue(); - else { + First = false; + } else { Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(Args); Success = false; } |