[cfe-commits] r164644 - in /cfe/trunk: include/clang/Driver/OptTable.h include/clang/Driver/Option.h lib/Driver/CC1AsOptions.cpp lib/Driver/DriverOptions.cpp lib/Driver/OptTable.cpp lib/Driver/Option.cpp

Michael J. Spencer bigcheesegs at gmail.com
Tue Sep 25 16:12:48 PDT 2012


Author: mspencer
Date: Tue Sep 25 18:12:48 2012
New Revision: 164644

URL: http://llvm.org/viewvc/llvm-project?rev=164644&view=rev
Log:
[Options] Store the option ID in OptTable::Info.

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

Modified: cfe/trunk/include/clang/Driver/OptTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/OptTable.h (original)
+++ cfe/trunk/include/clang/Driver/OptTable.h Tue Sep 25 18:12:48 2012
@@ -34,6 +34,7 @@
       const char *Name;
       const char *HelpText;
       const char *MetaVar;
+      unsigned ID;
       unsigned char Kind;
       unsigned char Param;
       unsigned short Flags;

Modified: cfe/trunk/include/clang/Driver/Option.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Option.h (original)
+++ cfe/trunk/include/clang/Driver/Option.h Tue Sep 25 18:12:48 2012
@@ -71,9 +71,6 @@
   private:
     const OptTable::Info *Info;
 
-    /// The option ID.
-    OptSpecifier ID;
-
     /// Group this option is a member of, if any.
     const Option *Group;
 
@@ -81,11 +78,11 @@
     const Option *Alias;
 
   public:
-    Option(const OptTable::Info *Info, OptSpecifier ID,
+    Option(const OptTable::Info *Info,
            const Option *Group, const Option *Alias);
     ~Option();
 
-    unsigned getID() const { return ID.getID(); }
+    unsigned getID() const { return Info->ID; }
     OptionClass getKind() const { return OptionClass(Info->Kind); }
     StringRef getName() const { return Info->Name; }
     const Option *getGroup() const { return Group; }

Modified: cfe/trunk/lib/Driver/CC1AsOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1AsOptions.cpp?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/CC1AsOptions.cpp (original)
+++ cfe/trunk/lib/Driver/CC1AsOptions.cpp Tue Sep 25 18:12:48 2012
@@ -18,7 +18,7 @@
 static const OptTable::Info CC1AsInfoTable[] = {
 #define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR)   \
-  { NAME, HELPTEXT, METAVAR, Option::KIND##Class, PARAM, FLAGS, \
+  { NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, FLAGS, \
     OPT_##GROUP, OPT_##ALIAS },
 #include "clang/Driver/CC1AsOptions.inc"
 };

Modified: cfe/trunk/lib/Driver/DriverOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/DriverOptions.cpp (original)
+++ cfe/trunk/lib/Driver/DriverOptions.cpp Tue Sep 25 18:12:48 2012
@@ -17,7 +17,7 @@
 static const OptTable::Info InfoTable[] = {
 #define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR)   \
-  { NAME, HELPTEXT, METAVAR, Option::KIND##Class, PARAM, FLAGS, \
+  { NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, FLAGS, \
     OPT_##GROUP, OPT_##ALIAS },
 #include "clang/Driver/Options.inc"
 };

Modified: cfe/trunk/lib/Driver/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/OptTable.cpp (original)
+++ cfe/trunk/lib/Driver/OptTable.cpp Tue Sep 25 18:12:48 2012
@@ -138,7 +138,7 @@
   const Option *Group = getOption(info.GroupID);
   const Option *Alias = getOption(info.AliasID);
 
-  Option *Opt = new Option(&info, id, Group, Alias);
+  Option *Opt = new Option(&info, Group, Alias);
 
   return Opt;
 }

Modified: cfe/trunk/lib/Driver/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=164644&r1=164643&r2=164644&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Option.cpp (original)
+++ cfe/trunk/lib/Driver/Option.cpp Tue Sep 25 18:12:48 2012
@@ -17,9 +17,9 @@
 #include <algorithm>
 using namespace clang::driver;
 
-Option::Option(const OptTable::Info *info, OptSpecifier _ID,
+Option::Option(const OptTable::Info *info,
                const Option *_Group, const Option *_Alias)
-  : Info(info), ID(_ID.getID()), Group(_Group), Alias(_Alias) {
+  : Info(info), Group(_Group), Alias(_Alias) {
 
   // Multi-level aliases are not supported, and alias options cannot
   // have groups. This just simplifies option tracking, it is not an
@@ -72,7 +72,7 @@
     return Alias->matches(Opt);
 
   // Check exact match.
-  if (ID == Opt)
+  if (getID() == Opt.getID())
     return true;
 
   if (Group)





More information about the cfe-commits mailing list