[cfe-commits] r137051 - /cfe/trunk/lib/Driver/ArgList.cpp

Chad Rosier mcrosier at apple.com
Mon Aug 8 10:17:15 PDT 2011


Author: mcrosier
Date: Mon Aug  8 12:17:15 2011
New Revision: 137051

URL: http://llvm.org/viewvc/llvm-project?rev=137051&view=rev
Log:
Improved efficiency by using iterator returned by erase, rather then restarting.
Thanks to David Blaikie for pointing this out.

Modified:
    cfe/trunk/lib/Driver/ArgList.cpp

Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=137051&r1=137050&r2=137051&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Mon Aug  8 12:17:15 2011
@@ -47,11 +47,11 @@
 }
 
 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;
     }
   }
 }





More information about the cfe-commits mailing list