diff options
author | Filipe Cabecinhas <me@filcab.net> | 2015-03-20 23:32:58 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2015-03-20 23:32:58 +0000 |
commit | e3f2e6fcfe35011ac9a6565dbe5f7e160683c797 (patch) | |
tree | 06e86062dcf2adf99bd0c85017399dc93353cdf8 /lib/Option | |
parent | 2c11db2e64ded7f6aa94dfc500aeb19a609e9d83 (diff) |
Make getLastArgNoClaim work for up to 4 arguments.
Summary:
This is needed for http://reviews.llvm.org/D8507
I have no idea what stand-alone tests could be done, if needed.
Reviewers: Bigcheese, craig.topper, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8508
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Option')
-rw-r--r-- | lib/Option/ArgList.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Option/ArgList.cpp b/lib/Option/ArgList.cpp index f2547d68842..4bc8f925e1b 100644 --- a/lib/Option/ArgList.cpp +++ b/lib/Option/ArgList.cpp @@ -63,6 +63,26 @@ Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1) const { return nullptr; } +Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1, + OptSpecifier Id2) const { + // FIXME: Make search efficient? + for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) + if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) || + (*it)->getOption().matches(Id2)) + return *it; + return nullptr; +} + +Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1, + OptSpecifier Id2, OptSpecifier Id3) const { + // FIXME: Make search efficient? + for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) + if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) || + (*it)->getOption().matches(Id2) || (*it)->getOption().matches(Id3)) + return *it; + return nullptr; +} + Arg *ArgList::getLastArg(OptSpecifier Id) const { Arg *Res = nullptr; for (const_iterator it = begin(), ie = end(); it != ie; ++it) { |