Index: llvm/trunk/include/llvm/Option/ArgList.h =================================================================== --- llvm/trunk/include/llvm/Option/ArgList.h +++ llvm/trunk/include/llvm/Option/ArgList.h @@ -187,6 +187,7 @@ /// /// \p Claim Whether the argument should be claimed, if it exists. Arg *getLastArgNoClaim(OptSpecifier Id) const; + Arg *getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1) const; Arg *getLastArg(OptSpecifier Id) const; Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1) const; Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const; Index: llvm/trunk/lib/Option/ArgList.cpp =================================================================== --- llvm/trunk/lib/Option/ArgList.cpp +++ llvm/trunk/lib/Option/ArgList.cpp @@ -54,6 +54,15 @@ return nullptr; } +Arg *ArgList::getLastArgNoClaim(OptSpecifier Id0, OptSpecifier Id1) 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)) + return *it; + return nullptr; +} + Arg *ArgList::getLastArg(OptSpecifier Id) const { Arg *Res = nullptr; for (const_iterator it = begin(), ie = end(); it != ie; ++it) {