diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-12 01:34:20 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-12 01:34:20 +0000 |
commit | 8fa943436bbb45a56ac2d1d7cdd7c323d07f72fe (patch) | |
tree | e77c98b94136dfd1a030448c341af68a07503bf9 /clang/lib/Driver/Option.cpp | |
parent | adca11c2ddb72aa70217b68aef5b07ee696183c6 (diff) | |
download | bcm5719-llvm-8fa943436bbb45a56ac2d1d7cdd7c323d07f72fe.tar.gz bcm5719-llvm-8fa943436bbb45a56ac2d1d7cdd7c323d07f72fe.zip |
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.
llvm-svn: 66757
Diffstat (limited to 'clang/lib/Driver/Option.cpp')
-rw-r--r-- | clang/lib/Driver/Option.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Driver/Option.cpp b/clang/lib/Driver/Option.cpp index f92e7aab265..7a74d34a86b 100644 --- a/clang/lib/Driver/Option.cpp +++ b/clang/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) { |