[cfe-commits] r70101 - in /cfe/trunk: include/clang/Driver/ArgList.h lib/Driver/ArgList.cpp
Daniel Dunbar
daniel at zuster.org
Sat Apr 25 18:07:52 PDT 2009
Author: ddunbar
Date: Sat Apr 25 20:07:52 2009
New Revision: 70101
URL: http://llvm.org/viewvc/llvm-project?rev=70101&view=rev
Log:
Add option for AddAllArgsTranslated to control whether output argument
should be joined or separate.
Modified:
cfe/trunk/include/clang/Driver/ArgList.h
cfe/trunk/lib/Driver/ArgList.cpp
Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=70101&r1=70100&r2=70101&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Sat Apr 25 20:07:52 2009
@@ -110,11 +110,15 @@
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.
Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=70101&r1=70100&r2=70101&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Sat Apr 25 20:07:52 2009
@@ -124,14 +124,22 @@
}
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));
+ }
}
}
}
More information about the cfe-commits
mailing list