From: Daniel Dunbar Date: Fri, 20 Mar 2009 15:59:01 +0000 (+0000) Subject: Driver: Add two option overload for AddAllArgValues. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee51031c3734176d00723054c765538fcffc0984;p=clang Driver: Add two option overload for AddAllArgValues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67377 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h index 67b08aa943..3fbeec7f90 100644 --- a/include/clang/Driver/ArgList.h +++ b/include/clang/Driver/ArgList.h @@ -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; /// @} }; diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index ee201f28bd..30da136e04 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -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)); + } + } +}