aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Driver/Option.h2
-rw-r--r--lib/Driver/Option.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/include/clang/Driver/Option.h b/include/clang/Driver/Option.h
index 546f9561d8..3a4177afa6 100644
--- a/include/clang/Driver/Option.h
+++ b/include/clang/Driver/Option.h
@@ -88,6 +88,7 @@ namespace driver {
public:
virtual ~Option();
+ options::ID getId() const { return ID; }
OptionClass getKind() const { return Kind; }
const char *getName() const { return Name; }
const OptionGroup *getGroup() const { return Group; }
@@ -124,6 +125,7 @@ namespace driver {
/// matches - Predicate for whether this option is part of the
/// given option (which may be a group).
bool matches(const Option *Opt) const;
+ bool matches(options::ID Id) const;
/// accept - Potentially accept the current argument, returning a
/// new Arg instance, or 0 if the option does not accept this
diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp
index f92e7aab26..7a74d34a86 100644
--- a/lib/Driver/Option.cpp
+++ b/lib/Driver/Option.cpp
@@ -86,6 +86,22 @@ bool Option::matches(const Option *Opt) const {
return false;
}
+bool Option::matches(options::ID Id) const {
+ // FIXME: Decide what to do here; we should either pull out the
+ // handling of alias on the option for Id from the other matches, or
+ // find some other solution (which hopefully doesn't require using
+ // the option table).
+ if (Alias)
+ return Alias->matches(Id);
+
+ if (ID == Id)
+ return true;
+
+ if (Group)
+ return Group->matches(Id);
+ return false;
+}
+
OptionGroup::OptionGroup(options::ID ID, const char *Name,
const OptionGroup *Group)
: Option(Option::GroupClass, ID, Name, Group, 0) {