aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Option.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2012-10-03 19:58:10 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2012-10-03 19:58:10 +0000
commit9b7dcdb53cee4234c48bb4ceeef39536419945cf (patch)
treeeb370024d6258b6bc5ee015b129e8762b808986f /lib/Driver/Option.cpp
parentfc44e88cbdf013d285f2e4e3962fb80dcad56770 (diff)
[Options] Store the owning OptTable in Option so it can construct Group and Alias.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165150 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Option.cpp')
-rw-r--r--lib/Driver/Option.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp
index 3be141e61d..117021b880 100644
--- a/lib/Driver/Option.cpp
+++ b/lib/Driver/Option.cpp
@@ -17,14 +17,13 @@
#include <algorithm>
using namespace clang::driver;
-Option::Option(const OptTable::Info *info,
- const Option *_Group, const Option *_Alias)
- : Info(info), Group(_Group), Alias(_Alias) {
+Option::Option(const OptTable::Info *info, const OptTable *owner)
+ : Info(info), Owner(owner) {
// Multi-level aliases are not supported, and alias options cannot
// have groups. This just simplifies option tracking, it is not an
// inherent limitation.
- assert((!Alias || (!Alias->Alias && !Group)) &&
+ assert((!getAlias() || (!getAlias()->getAlias() && !getGroup())) &&
"Multi-level aliases and aliases with groups are unsupported.");
}
@@ -50,11 +49,13 @@ void Option::dump() const {
llvm::errs() << " Name:\"" << getName() << '"';
+ const Option *Group = getGroup();
if (Group) {
llvm::errs() << " Group:";
Group->dump();
}
+ const Option *Alias = getAlias();
if (Alias) {
llvm::errs() << " Alias:";
Alias->dump();
@@ -68,6 +69,7 @@ void Option::dump() const {
bool Option::matches(OptSpecifier Opt) const {
// Aliases are never considered in matching, look through them.
+ const Option *Alias = getAlias();
if (Alias)
return Alias->matches(Opt);
@@ -75,6 +77,7 @@ bool Option::matches(OptSpecifier Opt) const {
if (getID() == Opt.getID())
return true;
+ const Option *Group = getGroup();
if (Group)
return Group->matches(Opt);
return false;