diff options
author | Tim Northover <tnorthover@apple.com> | 2014-07-09 13:03:37 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-07-09 13:03:37 +0000 |
commit | ac002d3e34cdf5d170b0607e4f0de79cf7f0ba60 (patch) | |
tree | 1171a70429eecbdb2b2387b66a647b66513df3ec /llvm/lib/Option/ArgList.cpp | |
parent | 5865a73a8249be95bcd786102a62f8956d5ed1b3 (diff) | |
download | bcm5719-llvm-ac002d3e34cdf5d170b0607e4f0de79cf7f0ba60.tar.gz bcm5719-llvm-ac002d3e34cdf5d170b0607e4f0de79cf7f0ba60.zip |
Generic: add range-adapter for option parsing.
I want to use it in lld, but while I'm here I'll update LLVM uses.
llvm-svn: 212615
Diffstat (limited to 'llvm/lib/Option/ArgList.cpp')
-rw-r--r-- | llvm/lib/Option/ArgList.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp index 28b42a8f829..5848bb11bfa 100644 --- a/llvm/lib/Option/ArgList.cpp +++ b/llvm/lib/Option/ArgList.cpp @@ -234,44 +234,40 @@ void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0, void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const { - for (arg_iterator it = filtered_begin(Id0, Id1, Id2), - ie = filtered_end(); it != ie; ++it) { - (*it)->claim(); - (*it)->render(*this, Output); + for (auto Arg: filtered(Id0, Id1, Id2)) { + Arg->claim(); + Arg->render(*this, Output); } } void ArgList::AddAllArgValues(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const { - for (arg_iterator it = filtered_begin(Id0, Id1, Id2), - ie = filtered_end(); it != ie; ++it) { - (*it)->claim(); - for (unsigned i = 0, e = (*it)->getNumValues(); i != e; ++i) - Output.push_back((*it)->getValue(i)); + for (auto Arg : filtered(Id0, Id1, Id2)) { + Arg->claim(); + for (unsigned i = 0, e = Arg->getNumValues(); i != e; ++i) + Output.push_back(Arg->getValue(i)); } } void ArgList::AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined) const { - for (arg_iterator it = filtered_begin(Id0), - ie = filtered_end(); it != ie; ++it) { - (*it)->claim(); + for (auto Arg: filtered(Id0)) { + Arg->claim(); if (Joined) { Output.push_back(MakeArgString(StringRef(Translation) + - (*it)->getValue(0))); + Arg->getValue(0))); } else { Output.push_back(Translation); - Output.push_back((*it)->getValue(0)); + Output.push_back(Arg->getValue(0)); } } } void ArgList::ClaimAllArgs(OptSpecifier Id0) const { - for (arg_iterator it = filtered_begin(Id0), - ie = filtered_end(); it != ie; ++it) - (*it)->claim(); + for (auto Arg : filtered(Id0)) + Arg->claim(); } void ArgList::ClaimAllArgs() const { |