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 | 008067aca9a49a13de3851bfae571a8a4e191b76 (patch) | |
tree | 97efe51d19bfcd2cd584c5fabcfe1415639f79ba /llvm/lib/Option/ArgList.cpp | |
parent | 1f1980d9ca8c985e51d4e0bd49deecfed7736b3d (diff) | |
download | bcm5719-llvm-008067aca9a49a13de3851bfae571a8a4e191b76.tar.gz bcm5719-llvm-008067aca9a49a13de3851bfae571a8a4e191b76.zip |
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
llvm-svn: 232859
Diffstat (limited to 'llvm/lib/Option/ArgList.cpp')
-rw-r--r-- | llvm/lib/Option/ArgList.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp index f2547d68842..4bc8f925e1b 100644 --- a/llvm/lib/Option/ArgList.cpp +++ b/llvm/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) { |