Driver: Update ArgList::{hasArg,getLastArg} to optionally claim the
arguments if they exist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 184725f..d32d9f2 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -30,13 +30,16 @@
   Args.push_back(A);
 }
 
-Arg *ArgList::getLastArg(options::ID Id) const {
+Arg *ArgList::getLastArg(options::ID Id, bool Claim) const {
   // FIXME: Make search efficient?
 
   // FIXME: This needs to not require loading of the option.
-  for (const_iterator it = begin(), ie = end(); it != ie; ++it)
-    if ((*it)->getOption().matches(Id))
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    if ((*it)->getOption().matches(Id)) {
+      if (Claim) (*it)->claim();
       return *it;
+    }
+  }
   
   return 0;
 }