/// getArgString - Return the input argument string at \arg Index.
virtual const char *getArgString(unsigned Index) const = 0;
+ /// getNumInputArgStrings - Return the number of original argument strings,
+ /// which are guaranteed to be the first strings in the argument string
+ /// list.
+ virtual unsigned getNumInputArgStrings() const = 0;
+
/// @}
/// @name Argument Lookup Utilities
/// @{
};
class InputArgList : public ArgList {
+ InputArgList(const ArgList &); // DO NOT IMPLEMENT
+ void operator=(const ArgList &); // DO NOT IMPLEMENT
+
private:
/// The internal list of arguments.
arglist_type ActualArgs;
public:
InputArgList(const char **ArgBegin, const char **ArgEnd);
- InputArgList(const ArgList &);
~InputArgList();
virtual const char *getArgString(unsigned Index) const {
return ArgStrings[Index];
}
- /// getNumInputArgStrings - Return the number of original input
- /// argument strings.
- unsigned getNumInputArgStrings() const { return NumInputArgStrings; }
+ virtual unsigned getNumInputArgStrings() const {
+ return NumInputArgStrings;
+ }
/// @name Arg Synthesis
/// @{
return BaseArgs.getArgString(Index);
}
+ virtual unsigned getNumInputArgStrings() const {
+ return BaseArgs.getNumInputArgStrings();
+ }
+
/// @name Arg Synthesis
/// @{
}
class Arg;
+ class ArgList;
class InputArgList;
class Option;
/// \return - The parsed argument, or 0 if the argument is missing values
/// (in which case Index still points at the conceptual next argument string
/// to parse).
- Arg *ParseOneArg(const InputArgList &Args, unsigned &Index) const;
+ Arg *ParseOneArg(const ArgList &Args, unsigned &Index) const;
/// ParseArgs - Parse an list of arguments into an InputArgList.
///
namespace clang {
namespace driver {
class Arg;
- class InputArgList;
+ class ArgList;
class OptionGroup;
/// Option - Abstract representation for a single form of driver
/// If the option accepts the current argument, accept() sets
/// Index to the position where argument parsing should resume
/// (even if the argument is missing values).
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const = 0;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const = 0;
void dump() const;
public:
OptionGroup(OptSpecifier ID, const char *Name, const OptionGroup *Group);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::GroupClass;
public:
InputOption(OptSpecifier ID);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::InputClass;
public:
UnknownOption(OptSpecifier ID);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::UnknownClass;
FlagOption(OptSpecifier ID, const char *Name, const OptionGroup *Group,
const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::FlagClass;
JoinedOption(OptSpecifier ID, const char *Name, const OptionGroup *Group,
const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::JoinedClass;
SeparateOption(OptSpecifier ID, const char *Name,
const OptionGroup *Group, const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::SeparateClass;
CommaJoinedOption(OptSpecifier ID, const char *Name,
const OptionGroup *Group, const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::CommaJoinedClass;
unsigned getNumArgs() const { return NumArgs; }
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::MultiArgClass;
JoinedOrSeparateOption(OptSpecifier ID, const char *Name,
const OptionGroup *Group, const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::JoinedOrSeparateClass;
JoinedAndSeparateOption(OptSpecifier ID, const char *Name,
const OptionGroup *Group, const Option *Alias);
- virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
+ virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
static bool classof(const Option *O) {
return O->getKind() == Option::JoinedAndSeparateClass;
return Opt;
}
-Arg *OptTable::ParseOneArg(const InputArgList &Args, unsigned &Index) const {
+Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index) const {
unsigned Prev = Index;
const char *Str = Args.getArgString(Index);
: Option(Option::GroupClass, ID, Name, Group, 0) {
}
-Arg *OptionGroup::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *OptionGroup::accept(const ArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an OptionGroup");
return 0;
}
: Option(Option::InputClass, ID, "<input>", 0, 0) {
}
-Arg *InputOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *InputOption::accept(const ArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an InputOption");
return 0;
}
: Option(Option::UnknownClass, ID, "<unknown>", 0, 0) {
}
-Arg *UnknownOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *UnknownOption::accept(const ArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an UnknownOption");
return 0;
}
: Option(Option::FlagClass, ID, Name, Group, Alias) {
}
-Arg *FlagOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *FlagOption::accept(const ArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
: Option(Option::JoinedClass, ID, Name, Group, Alias) {
}
-Arg *JoinedOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *JoinedOption::accept(const ArgList &Args, unsigned &Index) const {
// Always matches.
const char *Value = Args.getArgString(Index) + strlen(getName());
return new Arg(getUnaliasedOption(), Index++, Value);
: Option(Option::CommaJoinedClass, ID, Name, Group, Alias) {
}
-Arg *CommaJoinedOption::accept(const InputArgList &Args,
+Arg *CommaJoinedOption::accept(const ArgList &Args,
unsigned &Index) const {
// Always matches.
const char *Str = Args.getArgString(Index) + strlen(getName());
: Option(Option::SeparateClass, ID, Name, Group, Alias) {
}
-Arg *SeparateOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *SeparateOption::accept(const ArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
assert(NumArgs > 1 && "Invalid MultiArgOption!");
}
-Arg *MultiArgOption::accept(const InputArgList &Args, unsigned &Index) const {
+Arg *MultiArgOption::accept(const ArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
: Option(Option::JoinedOrSeparateClass, ID, Name, Group, Alias) {
}
-Arg *JoinedOrSeparateOption::accept(const InputArgList &Args,
+Arg *JoinedOrSeparateOption::accept(const ArgList &Args,
unsigned &Index) const {
// If this is not an exact match, it is a joined arg.
// FIXME: Avoid strlen.
: Option(Option::JoinedAndSeparateClass, ID, Name, Group, Alias) {
}
-Arg *JoinedAndSeparateOption::accept(const InputArgList &Args,
+Arg *JoinedAndSeparateOption::accept(const ArgList &Args,
unsigned &Index) const {
// Always matches.