aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Arg.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-20 01:12:00 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-20 01:12:00 +0000
commitbbd2a045871c1acff39c43dffd346adbb1b2dde5 (patch)
tree10638d0b880265701880dd7eaec2a9ec2836bfc5 /lib/Driver/Arg.cpp
parent8de30ffa2b60dbc672c0f3bcdaa07a8efcc3bcf8 (diff)
Driver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.
Also, simplify/fix SeparateArg::render with forced join. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99022 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Arg.cpp')
-rw-r--r--lib/Driver/Arg.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Driver/Arg.cpp b/lib/Driver/Arg.cpp
index a09ba095f1..7e61a1d414 100644
--- a/lib/Driver/Arg.cpp
+++ b/lib/Driver/Arg.cpp
@@ -10,6 +10,7 @@
#include "clang/Driver/Arg.h"
#include "clang/Driver/ArgList.h"
#include "clang/Driver/Option.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang::driver;
@@ -155,14 +156,12 @@ SeparateArg::SeparateArg(const Option *Opt, unsigned Index, unsigned _NumValues,
void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const {
if (getOption().hasForceJoinedRender()) {
assert(getNumValues() == 1 && "Cannot force joined render with > 1 args.");
- // FIXME: Avoid std::string.
- std::string Joined(getOption().getName());
- Joined += Args.getArgString(getIndex());
- Output.push_back(Args.MakeArgString(Joined.c_str()));
+ Output.push_back(Args.MakeArgString(llvm::StringRef(getOption().getName()) +
+ getValue(Args, 0)));
} else {
Output.push_back(Args.getArgString(getIndex()));
for (unsigned i = 0; i < NumValues; ++i)
- Output.push_back(Args.getArgString(getIndex() + 1 + i));
+ Output.push_back(getValue(Args, i));
}
}