Driver: Add ArgList::AddAllArgsTranslated; for forwarding options to

tools with the name of the option replace, and arguments rendered
separately.

llvm-svn: 67753
This commit is contained in:
Daniel Dunbar 2009-03-26 15:39:22 +00:00
parent a32f7a124a
commit 4e5696b984
2 changed files with 19 additions and 0 deletions

View 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
/// @{

View 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)