]> granicus.if.org Git - clang/commitdiff
Driver: Add two option overload for AddAllArgValues.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 20 Mar 2009 15:59:01 +0000 (15:59 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 20 Mar 2009 15:59:01 +0000 (15:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67377 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 67b08aa943e26c563fd8fb78a53d068ae33b267a..3fbeec7f904d3dec75145098fbf92374bf9335d0 100644 (file)
@@ -129,13 +129,16 @@ namespace driver {
 
     /// AddAllArgs - Render all arguments matching the given ids.
     void AddAllArgs(ArgStringList &Output, options::ID Id0) const;
-    void AddAllArgs(ArgStringList &Output, options::ID Id0, options::ID Id1) const;
+    void AddAllArgs(ArgStringList &Output, options::ID Id0, 
+                    options::ID Id1) const;
     void AddAllArgs(ArgStringList &Output, options::ID Id0, options::ID Id1, 
                     options::ID Id2) const;
 
     /// AddAllArgValues - Render the argument values of all arguments
     /// matching the given ids.
     void AddAllArgValues(ArgStringList &Output, options::ID Id0) const;
+    void AddAllArgValues(ArgStringList &Output, options::ID Id0, 
+                         options::ID Id1) const;
 
     /// @}
   };
index ee201f28bd145a821f2c3b2756a42ab6b8563fcc..30da136e048eae15a00ff9ff4b928b3348031105 100644 (file)
@@ -162,3 +162,16 @@ void ArgList::AddAllArgValues(ArgStringList &Output, options::ID Id0) const {
     }
   }
 }
+
+void ArgList::AddAllArgValues(ArgStringList &Output, options::ID Id0, 
+                              options::ID Id1) const {
+  // FIXME: Make fast.
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    const Arg *A = *it;
+    if (A->getOption().matches(Id0) || A->getOption().matches(Id1)) {
+      A->claim();
+      for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
+        Output.push_back(A->getValue(*this, i));
+    }
+  }
+}