diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp index 0d7b057c78cf..c76356ca20ba 100644 --- a/clang/lib/Driver/ArgList.cpp +++ b/clang/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; - } } }