summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Option.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-25 04:13:45 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-25 04:13:45 +0000
commitdac54a81df89223b6887408d9427501603d8648d (patch)
tree9bc9a6b8b42475cc1d67aa5cb9ccd4d6587abb45 /clang/lib/Driver/Option.cpp
parent68b0881d94f3b46d173038865b9fc02eb9b5f5d7 (diff)
downloadbcm5719-llvm-dac54a81df89223b6887408d9427501603d8648d.tar.gz
bcm5719-llvm-dac54a81df89223b6887408d9427501603d8648d.zip
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). llvm-svn: 67676
Diffstat (limited to 'clang/lib/Driver/Option.cpp')
-rw-r--r--clang/lib/Driver/Option.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/Driver/Option.cpp b/clang/lib/Driver/Option.cpp
index dc681c72957..6ea02aaf40e 100644
--- a/clang/lib/Driver/Option.cpp
+++ b/clang/lib/Driver/Option.cpp
@@ -107,7 +107,7 @@ OptionGroup::OptionGroup(options::ID ID, const char *Name,
: 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 @@ InputOption::InputOption()
: 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 @@ UnknownOption::UnknownOption()
: 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 @@ FlagOption::FlagOption(options::ID ID, const char *Name,
: 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 @@ JoinedOption::JoinedOption(options::ID ID, const char *Name,
: 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 @@ CommaJoinedOption::CommaJoinedOption(options::ID ID, const char *Name,
: 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 @@ SeparateOption::SeparateOption(options::ID ID, const char *Name,
: 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 @@ MultiArgOption::MultiArgOption(options::ID ID, const char *Name,
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 @@ JoinedOrSeparateOption::JoinedOrSeparateOption(options::ID ID, const char *Name,
: 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 @@ JoinedAndSeparateOption::JoinedAndSeparateOption(options::ID ID,
: Option(Option::JoinedAndSeparateClass, ID, Name, Group, Alias) {
}
-Arg *JoinedAndSeparateOption::accept(const ArgList &Args,
+Arg *JoinedAndSeparateOption::accept(const InputArgList &Args,
unsigned &Index) const {
// Always matches.
OpenPOWER on IntegriCloud