aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Driver/Option.h4
-rw-r--r--lib/Driver/OptTable.cpp9
-rw-r--r--lib/Driver/Option.cpp8
3 files changed, 10 insertions, 11 deletions
diff --git a/include/clang/Driver/Option.h b/include/clang/Driver/Option.h
index 5daeef942e..08b94b1d79 100644
--- a/include/clang/Driver/Option.h
+++ b/include/clang/Driver/Option.h
@@ -177,7 +177,7 @@ namespace driver {
/// InputOption - Dummy option class for representing driver inputs.
class InputOption : public Option {
public:
- InputOption();
+ InputOption(OptSpecifier ID);
virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
@@ -190,7 +190,7 @@ namespace driver {
/// UnknownOption - Dummy option class for represent unknown arguments.
class UnknownOption : public Option {
public:
- UnknownOption();
+ UnknownOption(OptSpecifier ID);
virtual Arg *accept(const InputArgList &Args, unsigned &Index) const;
diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp
index fae7f75f37..890907b2a7 100644
--- a/lib/Driver/OptTable.cpp
+++ b/lib/Driver/OptTable.cpp
@@ -136,9 +136,9 @@ Option *OptTable::CreateOption(unsigned id) const {
Option *Opt = 0;
switch (info.Kind) {
case Option::InputClass:
- Opt = new InputOption(); break;
+ Opt = new InputOption(id); break;
case Option::UnknownClass:
- Opt = new UnknownOption(); break;
+ Opt = new UnknownOption(id); break;
case Option::GroupClass:
Opt = new OptionGroup(id, info.Name, Group); break;
case Option::FlagClass:
@@ -188,7 +188,7 @@ Arg *OptTable::ParseOneArg(const InputArgList &Args, unsigned &Index) const {
return new PositionalArg(TheInputOption, Index++);
const Info *Start = OptionInfos + FirstSearchableIndex;
- const Info *End = OptionInfos + LastOption - 1;
+ const Info *End = OptionInfos + getNumOptions();
// Search for the first next option which could be a prefix.
Start = std::lower_bound(Start, End, Str);
@@ -210,8 +210,7 @@ Arg *OptTable::ParseOneArg(const InputArgList &Args, unsigned &Index) const {
break;
// See if this option matches.
- options::ID id = (options::ID) (Start - OptionInfos + 1);
- if (Arg *A = getOption(id)->accept(Args, Index))
+ if (Arg *A = getOption(Start - OptionInfos + 1)->accept(Args, Index))
return A;
// Otherwise, see if this argument was missing values.
diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp
index 89e99999cf..17d00f50aa 100644
--- a/lib/Driver/Option.cpp
+++ b/lib/Driver/Option.cpp
@@ -94,8 +94,8 @@ Arg *OptionGroup::accept(const InputArgList &Args, unsigned &Index) const {
return 0;
}
-InputOption::InputOption()
- : Option(Option::InputClass, options::OPT_INPUT, "<input>", 0, 0) {
+InputOption::InputOption(OptSpecifier ID)
+ : Option(Option::InputClass, ID, "<input>", 0, 0) {
}
Arg *InputOption::accept(const InputArgList &Args, unsigned &Index) const {
@@ -103,8 +103,8 @@ Arg *InputOption::accept(const InputArgList &Args, unsigned &Index) const {
return 0;
}
-UnknownOption::UnknownOption()
- : Option(Option::UnknownClass, options::OPT_UNKNOWN, "<unknown>", 0, 0) {
+UnknownOption::UnknownOption(OptSpecifier ID)
+ : Option(Option::UnknownClass, ID, "<unknown>", 0, 0) {
}
Arg *UnknownOption::accept(const InputArgList &Args, unsigned &Index) const {