aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-17 18:51:42 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-17 18:51:42 +0000
commitcd4e186cdc1db0dcac937eb20afe8b5f5ff1a38d (patch)
treeaf3a5020efc5110d1c28834513686737993177e0
parent441d060838a5797691777dfcc992ff836b73dcd1 (diff)
Driver: Add two option form of ArgList::getLastArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67090 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/ArgList.h1
-rw-r--r--lib/Driver/ArgList.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h
index 06c434c022..9e6996bd08 100644
--- a/include/clang/Driver/ArgList.h
+++ b/include/clang/Driver/ArgList.h
@@ -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
/// @{
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 66fcb70885..d273516107 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -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();