Driver: Prep for tool chain specific argument translation.
- Lift ArgList to a base class for InputArgList and DerivedArgList.
- This is not a great decomposition, but it does embed the
translation into the type system, and keep things efficient for
tool chains that don't want to do any translation.
- No intended functionality change.
Eventually I hope to get rid of tool chain specific translation and
have each tool do the right thing, but for now this is the easiest way
to match gcc precisely (which is good for testing).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67676 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp
index dc681c7..6ea02aa 100644
--- a/lib/Driver/Option.cpp
+++ b/lib/Driver/Option.cpp
@@ -107,7 +107,7 @@
: Option(Option::GroupClass, ID, Name, Group, 0) {
}
-Arg *OptionGroup::accept(const ArgList &Args, unsigned &Index) const {
+Arg *OptionGroup::accept(const InputArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an OptionGroup");
return 0;
}
@@ -116,7 +116,7 @@
: Option(Option::InputClass, options::OPT_INPUT, "<input>", 0, 0) {
}
-Arg *InputOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *InputOption::accept(const InputArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an InputOption");
return 0;
}
@@ -125,7 +125,7 @@
: Option(Option::UnknownClass, options::OPT_UNKNOWN, "<unknown>", 0, 0) {
}
-Arg *UnknownOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *UnknownOption::accept(const InputArgList &Args, unsigned &Index) const {
assert(0 && "accept() should never be called on an UnknownOption");
return 0;
}
@@ -135,7 +135,7 @@
: Option(Option::FlagClass, ID, Name, Group, Alias) {
}
-Arg *FlagOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *FlagOption::accept(const InputArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
@@ -149,7 +149,7 @@
: Option(Option::JoinedClass, ID, Name, Group, Alias) {
}
-Arg *JoinedOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *JoinedOption::accept(const InputArgList &Args, unsigned &Index) const {
// Always matches.
return new JoinedArg(this, Index++);
}
@@ -160,7 +160,8 @@
: Option(Option::CommaJoinedClass, ID, Name, Group, Alias) {
}
-Arg *CommaJoinedOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *CommaJoinedOption::accept(const InputArgList &Args,
+ unsigned &Index) const {
// Always matches. We count the commas now so we can answer
// getNumValues easily.
@@ -175,7 +176,7 @@
: Option(Option::SeparateClass, ID, Name, Group, Alias) {
}
-Arg *SeparateOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *SeparateOption::accept(const InputArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
@@ -195,7 +196,7 @@
assert(NumArgs > 1 && "Invalid MultiArgOption!");
}
-Arg *MultiArgOption::accept(const ArgList &Args, unsigned &Index) const {
+Arg *MultiArgOption::accept(const InputArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
@@ -214,7 +215,7 @@
: Option(Option::JoinedOrSeparateClass, ID, Name, Group, Alias) {
}
-Arg *JoinedOrSeparateOption::accept(const ArgList &Args,
+Arg *JoinedOrSeparateOption::accept(const InputArgList &Args,
unsigned &Index) const {
// If this is not an exact match, it is a joined arg.
// FIXME: Avoid strlen.
@@ -236,7 +237,7 @@
: Option(Option::JoinedAndSeparateClass, ID, Name, Group, Alias) {
}
-Arg *JoinedAndSeparateOption::accept(const ArgList &Args,
+Arg *JoinedAndSeparateOption::accept(const InputArgList &Args,
unsigned &Index) const {
// Always matches.