[cfe-commits] r89306 - in /cfe/trunk: include/clang/Driver/Option.h lib/Driver/Option.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 18 19:26:50 PST 2009


Author: ddunbar
Date: Wed Nov 18 21:26:50 2009
New Revision: 89306

URL: http://llvm.org/viewvc/llvm-project?rev=89306&view=rev
Log:
Driver: Resolve inconsistency in matching options against options which are
aliases -- just treat this case as an (unchecked) client error.

Modified:
    cfe/trunk/include/clang/Driver/Option.h
    cfe/trunk/lib/Driver/Option.cpp

Modified: cfe/trunk/include/clang/Driver/Option.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=89306&r1=89305&r2=89306&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Option.h (original)
+++ cfe/trunk/include/clang/Driver/Option.h Wed Nov 18 21:26:50 2009
@@ -136,6 +136,10 @@
 
     /// matches - Predicate for whether this option is part of the
     /// given option (which may be a group).
+    ///
+    /// Note that matches against options which are an alias should never be
+    /// done -- aliases do not participate in matching and so such a query will
+    /// always be false.
     bool matches(const Option *Opt) const;
     bool matches(unsigned Id) const;
 

Modified: cfe/trunk/lib/Driver/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=89306&r1=89305&r2=89306&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Option.cpp (original)
+++ cfe/trunk/lib/Driver/Option.cpp Wed Nov 18 21:26:50 2009
@@ -71,9 +71,7 @@
 }
 
 bool Option::matches(const Option *Opt) const {
-  // Aliases are never considered in matching.
-  if (Opt->getAlias())
-    return matches(Opt->getAlias());
+  // Aliases are never considered in matching, look through them.
   if (Alias)
     return Alias->matches(Opt);
 
@@ -86,10 +84,7 @@
 }
 
 bool Option::matches(unsigned 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).
+  // Aliases are never considered in matching, look through them.
   if (Alias)
     return Alias->matches(Id);
 





More information about the cfe-commits mailing list