Driver: Add Arg::dump and SeparateArg stubs.

llvm-svn: 66100
This commit is contained in:
Daniel Dunbar 2009-03-04 23:02:50 +00:00
parent 5e55d41cd7
commit 135837e046
2 changed files with 43 additions and 0 deletions

View File

@ -71,6 +71,8 @@ namespace driver {
virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
static bool classof(const Arg *) { return true; }
void dump() const;
};
/// PositionalArg - A simple positional argument.

View File

@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "clang/Driver/Arg.h"
#include "clang/Driver/Option.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang::driver;
@ -20,6 +22,33 @@ Arg::Arg(ArgClass _Kind, const Option *_Opt, unsigned _Index)
Arg::~Arg() { }
void Arg::dump() const {
llvm::errs() << "<";
switch (Kind) {
default:
assert(0 && "Invalid kind");
#define P(N) case N: llvm::errs() << #N; break
P(PositionalClass);
P(JoinedClass);
P(SeparateClass);
P(CommaJoinedClass);
P(JoinedAndSeparateClass);
#undef P
}
llvm::errs() << " Opt:";
Opt->dump();
llvm::errs() << " Index:" << Index;
if (const CommaJoinedArg *CJA = dyn_cast<CommaJoinedArg>(this))
llvm::errs() << " NumValues:" << CJA->getNumValues();
llvm::errs() << ">\n";
llvm::errs().flush(); // FIXME
}
PositionalArg::PositionalArg(const Option *Opt, unsigned Index)
: Arg(PositionalClass, Opt, Index) {
}
@ -57,6 +86,18 @@ const char *CommaJoinedArg::getValue(const ArgList &Args, unsigned N) const {
assert(0 && "FIXME: Implement");
}
SeparateArg::SeparateArg(const Option *Opt, unsigned Index, unsigned _NumValues)
: Arg(SeparateClass, Opt, Index), NumValues(_NumValues) {
}
void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const {
assert(0 && "FIXME: Implement");
}
const char *SeparateArg::getValue(const ArgList &Args, unsigned N) const {
assert(0 && "FIXME: Implement");
}
JoinedAndSeparateArg::JoinedAndSeparateArg(const Option *Opt, unsigned Index)
: Arg(JoinedAndSeparateClass, Opt, Index) {
}