llvm.org GIT mirror llvm / aad181f
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209088 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 6 years ago
2 changed file(s) with 4 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
6666 const char *Value0, const char *Value1, const Arg *BaseArg = nullptr);
6767 ~Arg();
6868
69 const Option getOption() const { return Opt; }
69 const Option &getOption() const { return Opt; }
7070 StringRef getSpelling() const { return Spelling; }
7171 unsigned getIndex() const { return Index; }
7272
4040 }
4141
4242 void ArgList::eraseArg(OptSpecifier Id) {
43 for (iterator it = begin(), ie = end(); it != ie; ) {
44 if ((*it)->getOption().matches(Id)) {
45 it = Args.erase(it);
46 ie = end();
47 } else {
48 ++it;
49 }
50 }
43 Args.erase(std::remove_if(begin(), end(),
44 [=](Arg *A) { return A->getOption().matches(Id); }),
45 end());
5146 }
5247
5348 Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {