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:
Chad Rosier 2011-08-08 17:17:15 +00:00
parent 4f0ace5674
commit 261f9ce371
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}
}
}