aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ArgList.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-08-08 17:17:15 +0000
committerChad Rosier <mcrosier@apple.com>2011-08-08 17:17:15 +0000
commitaec8f4538dfc4fbe9dca92db63688b84f8f0c2a1 (patch)
tree3801d7b5d886cf3cb3dae82d33f9c3caa33a2a90 /lib/Driver/ArgList.cpp
parent1661d717563d6a27dec3da69deba2b2efaa45802 (diff)
Improved efficiency by using iterator returned by erase, rather then restarting.
Thanks to David Blaikie for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ArgList.cpp')
-rw-r--r--lib/Driver/ArgList.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index e5341884ee..0d7b057c78 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -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;
}
}
}