aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Option.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-12 01:34:20 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-12 01:34:20 +0000
commitcf0dd156e7b9d6a70b7290f5af9646859631bd9a (patch)
treebab5bd2d0e25d20b0fd728de7a8ed620538a873a /lib/Driver/Option.cpp
parentd377522ba694e52128b419c98dabae7086ccf9c6 (diff)
Driver: Add Option::getId and Option::matches taking an option
identifier; we will want to use the latter in situations where we just want to check for a match, but not load options unnecessarily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Option.cpp')
-rw-r--r--lib/Driver/Option.cpp16
1 files changed, 16 insertions, 0 deletions
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) {