From: Chad Rosier Date: Fri, 12 Aug 2011 23:38:19 +0000 (+0000) Subject: [driver] Make sure to update the iterator end when erasing for Args. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b18d503bc939281d8ea0dacea44e847297b92e8d;p=clang [driver] Make sure to update the iterator end when erasing for Args. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137539 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index 0d7b057c78..c76356ca20 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -50,9 +50,9 @@ void ArgList::eraseArg(OptSpecifier Id) { for (iterator it = begin(), ie = end(); it != ie; ) { if ((*it)->getOption().matches(Id)) { it = Args.erase(it); - } else { + ie = end(); + } else ++it; - } } }