diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-26 15:39:22 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-26 15:39:22 +0000 |
commit | 524b9fb54564ab8bc437118ed55ee7c9e8c1247d (patch) | |
tree | 1182603b762407d0c748584d450d1100d4dc18f5 | |
parent | 84304565e238bea1bd87ac68fb5e7810e381a9e2 (diff) |
Driver: Add ArgList::AddAllArgsTranslated; for forwarding options to
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
-rw-r--r-- | include/clang/Driver/ArgList.h | 6 | ||||
-rw-r--r-- | lib/Driver/ArgList.cpp | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h index fea6dd8ef2..226d8193a9 100644 --- a/include/clang/Driver/ArgList.h +++ b/include/clang/Driver/ArgList.h @@ -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 /// @{ diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index bd3aab351d..44549b0636 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -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) |