]> granicus.if.org Git - clang/commitdiff
Driver: Add two option form of ArgList::getLastArg.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 18:51:42 +0000 (18:51 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 18:51:42 +0000 (18:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67090 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/ArgList.h
lib/Driver/ArgList.cpp

index 06c434c0225b7b6ebb84c4e9839b0bea4b0b3e65..9e6996bd08e3194d0b693ee8583213076cf579a2 100644 (file)
@@ -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
     /// @{
index 66fcb708856c922a82b70a9eacf894c936cd8e06..d273516107276301ee7c6718f8badc620a1a7cfd 100644 (file)
@@ -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();