diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-05-18 15:14:13 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-05-18 15:14:13 +0000 |
commit | f9d2d512c7476e60b6a3a7f626550580b79da613 (patch) | |
tree | cabbad8db28eda8a472e962c2a2a5d7ace3cb373 /llvm/lib/Option | |
parent | f30d4460fcf3fbe465757d9aae7d6c2a9fbdb1ea (diff) | |
download | bcm5719-llvm-f9d2d512c7476e60b6a3a7f626550580b79da613.tar.gz bcm5719-llvm-f9d2d512c7476e60b6a3a7f626550580b79da613.zip |
Options: Use erase_if to remove Args from the list.
While there make getOption return a const reference so we don't have to put it
on the stack when calling methods on it. No functionality change.
llvm-svn: 209088
Diffstat (limited to 'llvm/lib/Option')
-rw-r--r-- | llvm/lib/Option/ArgList.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp index 1f16331e079..a5ab8d747d8 100644 --- a/llvm/lib/Option/ArgList.cpp +++ b/llvm/lib/Option/ArgList.cpp @@ -41,14 +41,9 @@ void ArgList::append(Arg *A) { } void ArgList::eraseArg(OptSpecifier Id) { - for (iterator it = begin(), ie = end(); it != ie; ) { - if ((*it)->getOption().matches(Id)) { - it = Args.erase(it); - ie = end(); - } else { - ++it; - } - } + Args.erase(std::remove_if(begin(), end(), + [=](Arg *A) { return A->getOption().matches(Id); }), + end()); } Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const { |