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

Daniel Dunbar daniel at zuster.org
Thu Mar 26 08:39:22 PDT 2009


Author: ddunbar
Date: Thu Mar 26 10:39:22 2009
New Revision: 67753

URL: http://llvm.org/viewvc/llvm-project?rev=67753&view=rev
Log:
Driver: Add ArgList::AddAllArgsTranslated; for forwarding options to
tools with the name of the option replace, and arguments rendered
separately.

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=67753&r1=67752&r2=67753&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Thu Mar 26 10:39:22 2009
@@ -110,6 +110,12 @@
     void AddAllArgValues(ArgStringList &Output, options::ID Id0, 
                          options::ID Id1) const;
 
+    // AddAllArgsTranslated - Render all the arguments matching the
+    // given ids, but forced to separate args and using the provided
+    // name instead of the first option value.
+    void AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
+                              const char *Translation) 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=67753&r1=67752&r2=67753&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Thu Mar 26 10:39:22 2009
@@ -127,6 +127,19 @@
   }
 }
 
+void ArgList::AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
+                                   const char *Translation) const {
+  // FIXME: Make fast.
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    const Arg *A = *it;
+    if (A->getOption().matches(Id0)) {
+      A->claim();
+      Output.push_back(Translation);
+      Output.push_back(A->getValue(*this, 0));
+    }
+  }
+}
+
 //
 
 InputArgList::InputArgList(const char **ArgBegin, const char **ArgEnd) 





More information about the cfe-commits mailing list