]> granicus.if.org Git - clang/commitdiff
Add option for AddAllArgsTranslated to control whether output argument
authorDaniel Dunbar <daniel@zuster.org>
Sun, 26 Apr 2009 01:07:52 +0000 (01:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 26 Apr 2009 01:07:52 +0000 (01:07 +0000)
should be joined or separate.

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

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

index 7e0427d9b5dd16c606a66d0f1735deb4f7a97f16..cff82c185eae802bc3a95089de957276cb95ccd5 100644 (file)
@@ -110,11 +110,15 @@ 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.
+    /// 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.
+    ///
+    /// \param Joined - If true, render the argument as joined with
+    /// the option specifier.
     void AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
-                              const char *Translation) const;
+                              const char *Translation, 
+                              bool Joined = false) const;
 
     /// ClaimAllArgs - Claim all arguments which match the given
     /// option id.
index 78236730248b0db1a43de4430552918786f57958..593694cfbbf678850513fdceb83c7de8541883fc 100644 (file)
@@ -124,14 +124,22 @@ void ArgList::AddAllArgValues(ArgStringList &Output, options::ID Id0,
 }
 
 void ArgList::AddAllArgsTranslated(ArgStringList &Output, options::ID Id0,
-                                   const char *Translation) const {
+                                   const char *Translation,
+                                   bool Joined) 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));
+
+      if (Joined) {
+        std::string Value = Translation;
+        Value += A->getValue(*this, 0);
+        Output.push_back(MakeArgString(Value.c_str()));
+      } else {
+        Output.push_back(Translation);
+        Output.push_back(A->getValue(*this, 0));
+      }
     }
   }
 }