diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-15 00:48:16 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-15 00:48:16 +0000 |
commit | 8022fd46d45005de63306a7513aece20a1be16ed (patch) | |
tree | cab726771b33b144146ab35623ad873bdd64ab28 /lib/Driver/ArgList.cpp | |
parent | 85c491064b33e8d407166256a9e639bc1fcad4ef (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.cpp | 9 |
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; } |