[cfe-commits] r67090 - in /cfe/trunk: include/clang/Driver/ArgList.h lib/Driver/ArgList.cpp

Daniel Dunbar daniel at zuster.org
Tue Mar 17 11:51:43 PDT 2009


Author: ddunbar
Date: Tue Mar 17 13:51:42 2009
New Revision: 67090

URL: http://llvm.org/viewvc/llvm-project?rev=67090&view=rev
Log:
Driver: Add two option form of ArgList::getLastArg.

Modified:
    cfe/trunk/include/clang/Driver/ArgList.h
    cfe/trunk/lib/Driver/ArgList.cpp

Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=67090&r1=67089&r2=67090&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Tue Mar 17 13:51:42 2009
@@ -81,6 +81,7 @@
     ///
     /// \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
     /// @{

Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=67090&r1=67089&r2=67090&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Tue Mar 17 13:51:42 2009
@@ -44,6 +44,20 @@
   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();
 





More information about the cfe-commits mailing list