]> granicus.if.org Git - clang/commitdiff
Driver: Add ArgList::AddAllArgsTranslated; for forwarding options to
authorDaniel Dunbar <daniel@zuster.org>
Thu, 26 Mar 2009 15:39:22 +0000 (15:39 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 26 Mar 2009 15:39:22 +0000 (15:39 +0000)
tools with the name of the option replace, and arguments rendered
separately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67753 91177308-0d34-0410-b5e6-96231b3b80d8

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

index fea6dd8ef25636d8b5e12b5608af052b3315b8ba..226d8193a99726b7343d95a0aa8abbb05e239985 100644 (file)
@@ -110,6 +110,12 @@ namespace driver {
     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
     /// @{
index bd3aab351d622ae316f02b1189e7a0c12f549101..44549b0636b067f8a0510288227a0cb0f9f1f83f 100644 (file)
@@ -127,6 +127,19 @@ void ArgList::AddAllArgValues(ArgStringList &Output, options::ID Id0,
   }
 }
 
+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)