forked from OSchip/llvm-project
Improved efficiency by using iterator returned by erase, rather then restarting.
Thanks to David Blaikie for pointing this out. llvm-svn: 137051
This commit is contained in:
parent
4f0ace5674
commit
261f9ce371
|
@ -47,11 +47,11 @@ void ArgList::append(Arg *A) {
|
|||
}
|
||||
|
||||
void ArgList::eraseArg(OptSpecifier Id) {
|
||||
for (iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||
for (iterator it = begin(), ie = end(); it != ie; ) {
|
||||
if ((*it)->getOption().matches(Id)) {
|
||||
Args.erase(it);
|
||||
it = begin();
|
||||
ie = end();
|
||||
it = Args.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue