[cfe-commits] r67182 - /cfe/trunk/lib/Driver/Arg.cpp
Daniel Dunbar
daniel at zuster.org
Wed Mar 18 01:01:48 PDT 2009
Author: ddunbar
Date: Wed Mar 18 03:01:48 2009
New Revision: 67182
URL: http://llvm.org/viewvc/llvm-project?rev=67182&view=rev
Log:
Driver: Provide Arg::render implementations.
Modified:
cfe/trunk/lib/Driver/Arg.cpp
Modified: cfe/trunk/lib/Driver/Arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=67182&r1=67181&r2=67182&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Arg.cpp (original)
+++ cfe/trunk/lib/Driver/Arg.cpp Wed Mar 18 03:01:48 2009
@@ -55,7 +55,7 @@
}
void FlagArg::render(const ArgList &Args, ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ Output.push_back(Args.getArgString(getIndex()));
}
const char *FlagArg::getValue(const ArgList &Args, unsigned N) const {
@@ -68,7 +68,7 @@
}
void PositionalArg::render(const ArgList &Args, ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ Output.push_back(Args.getArgString(getIndex()));
}
const char *PositionalArg::getValue(const ArgList &Args, unsigned N) const {
@@ -81,7 +81,12 @@
}
void JoinedArg::render(const ArgList &Args, ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ if (getOption().hasForceSeparateRender()) {
+ Output.push_back(getOption().getName());
+ Output.push_back(getValue(Args, 0));
+ } else {
+ Output.push_back(Args.getArgString(getIndex()));
+ }
}
const char *JoinedArg::getValue(const ArgList &Args, unsigned N) const {
@@ -110,7 +115,7 @@
}
void CommaJoinedArg::render(const ArgList &Args, ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ Output.push_back(Args.getArgString(getIndex()));
}
const char *CommaJoinedArg::getValue(const ArgList &Args, unsigned N) const {
@@ -123,7 +128,17 @@
}
void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ 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()));
+ } else {
+ Output.push_back(Args.getArgString(getIndex()));
+ for (unsigned i = 0; i < NumValues; ++i)
+ Output.push_back(Args.getArgString(getIndex() + 1 + i));
+ }
}
const char *SeparateArg::getValue(const ArgList &Args, unsigned N) const {
@@ -137,7 +152,8 @@
void JoinedAndSeparateArg::render(const ArgList &Args,
ArgStringList &Output) const {
- assert(0 && "FIXME: Implement");
+ Output.push_back(Args.getArgString(getIndex()));
+ Output.push_back(Args.getArgString(getIndex()) + 1);
}
const char *JoinedAndSeparateArg::getValue(const ArgList &Args,
More information about the cfe-commits
mailing list