mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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
This commit is contained in:
parent
bf3e78f572
commit
aad181f644
@ -67,7 +67,7 @@ public:
|
|||||||
const char *Value0, const char *Value1, const Arg *BaseArg = nullptr);
|
const char *Value0, const char *Value1, const Arg *BaseArg = nullptr);
|
||||||
~Arg();
|
~Arg();
|
||||||
|
|
||||||
const Option getOption() const { return Opt; }
|
const Option &getOption() const { return Opt; }
|
||||||
StringRef getSpelling() const { return Spelling; }
|
StringRef getSpelling() const { return Spelling; }
|
||||||
unsigned getIndex() const { return Index; }
|
unsigned getIndex() const { return Index; }
|
||||||
|
|
||||||
|
@ -41,14 +41,9 @@ void ArgList::append(Arg *A) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArgList::eraseArg(OptSpecifier Id) {
|
void ArgList::eraseArg(OptSpecifier Id) {
|
||||||
for (iterator it = begin(), ie = end(); it != ie; ) {
|
Args.erase(std::remove_if(begin(), end(),
|
||||||
if ((*it)->getOption().matches(Id)) {
|
[=](Arg *A) { return A->getOption().matches(Id); }),
|
||||||
it = Args.erase(it);
|
end());
|
||||||
ie = end();
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {
|
Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user