forked from OSchip/llvm-project
Driver: Add two option form of ArgList::getLastArg.
llvm-svn: 67090
This commit is contained in:
parent
e549493a55
commit
c1b70b2039
|
@ -81,6 +81,7 @@ namespace driver {
|
|||
///
|
||||
/// \arg Claim Whether the argument should be claimed, if it exists.
|
||||
Arg *getLastArg(options::ID Id, bool Claim=true) const;
|
||||
Arg *getLastArg(options::ID Id0, options::ID Id1, bool Claim=true) const;
|
||||
|
||||
/// @name Arg Synthesis
|
||||
/// @{
|
||||
|
|
|
@ -44,6 +44,20 @@ Arg *ArgList::getLastArg(options::ID Id, bool Claim) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
Arg *ArgList::getLastArg(options::ID Id0, options::ID Id1, bool Claim) const {
|
||||
Arg *Res, *A0 = getLastArg(Id0, false), *A1 = getLastArg(Id1, false);
|
||||
|
||||
if (A0 && A1)
|
||||
Res = A0->getIndex() > A1->getIndex() ? A0 : A1;
|
||||
else
|
||||
Res = A0 ? A0 : A1;
|
||||
|
||||
if (Claim && Res)
|
||||
Res->claim();
|
||||
|
||||
return Res;
|
||||
}
|
||||
|
||||
unsigned ArgList::MakeIndex(const char *String0) const {
|
||||
unsigned Index = ArgStrings.size();
|
||||
|
||||
|
|
Loading…
Reference in New Issue