aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ArgList.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-15 00:48:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-15 00:48:16 +0000
commit8022fd46d45005de63306a7513aece20a1be16ed (patch)
treecab726771b33b144146ab35623ad873bdd64ab28 /lib/Driver/ArgList.cpp
parent85c491064b33e8d407166256a9e639bc1fcad4ef (diff)
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
Diffstat (limited to 'lib/Driver/ArgList.cpp')
-rw-r--r--lib/Driver/ArgList.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 184725f796..d32d9f2185 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -30,13 +30,16 @@ void ArgList::append(Arg *A) {
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;
}