r186518 - Option parsing tables: remove some unnecessary #defines

Hans Wennborg hans at hanshq.net
Wed Jul 17 09:54:06 PDT 2013


Author: hans
Date: Wed Jul 17 11:54:06 2013
New Revision: 186518

URL: http://llvm.org/viewvc/llvm-project?rev=186518&view=rev
Log:
Option parsing tables: remove some unnecessary #defines

Also make some strings static and add missing #undef's

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

Modified: cfe/trunk/include/clang/Driver/CC1AsOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.h?rev=186518&r1=186517&r2=186518&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1AsOptions.h (original)
+++ cfe/trunk/include/clang/Driver/CC1AsOptions.h Wed Jul 17 11:54:06 2013
@@ -22,13 +22,11 @@ namespace driver {
 namespace cc1asoptions {
   enum ID {
     OPT_INVALID = 0, // This is not an option ID.
-#define PREFIX(NAME, VALUE)
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR) OPT_##ID,
 #include "clang/Driver/CC1AsOptions.inc"
     LastOption
 #undef OPTION
-#undef PREFIX
   };
 }
 

Modified: cfe/trunk/include/clang/Driver/Options.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.h?rev=186518&r1=186517&r2=186518&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.h (original)
+++ cfe/trunk/include/clang/Driver/Options.h Wed Jul 17 11:54:06 2013
@@ -34,13 +34,11 @@ enum ClangFlags {
 
 enum ID {
     OPT_INVALID = 0, // This is not an option ID.
-#define PREFIX(NAME, VALUE)
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR) OPT_##ID,
 #include "clang/Driver/Options.inc"
     LastOption
 #undef OPTION
-#undef PREFIX
   };
 }
 

Modified: cfe/trunk/lib/Driver/CC1AsOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1AsOptions.cpp?rev=186518&r1=186517&r2=186518&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/CC1AsOptions.cpp (original)
+++ cfe/trunk/lib/Driver/CC1AsOptions.cpp Wed Jul 17 11:54:06 2013
@@ -16,20 +16,17 @@ using namespace clang::driver;
 using namespace llvm::opt;
 using namespace clang::driver::cc1asoptions;
 
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
-#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
-               HELPTEXT, METAVAR)
+#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
 #include "clang/Driver/CC1AsOptions.inc"
-#undef OPTION
 #undef PREFIX
 
 static const OptTable::Info CC1AsInfoTable[] = {
-#define PREFIX(NAME, VALUE)
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR)   \
   { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, \
     FLAGS, OPT_##GROUP, OPT_##ALIAS },
 #include "clang/Driver/CC1AsOptions.inc"
+#undef OPTION
 };
 
 namespace {

Modified: cfe/trunk/lib/Driver/DriverOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=186518&r1=186517&r2=186518&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/DriverOptions.cpp (original)
+++ cfe/trunk/lib/Driver/DriverOptions.cpp Wed Jul 17 11:54:06 2013
@@ -16,20 +16,17 @@ using namespace clang::driver;
 using namespace clang::driver::options;
 using namespace llvm::opt;
 
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
-#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
-               HELPTEXT, METAVAR)
+#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
 #include "clang/Driver/Options.inc"
-#undef OPTION
 #undef PREFIX
 
 static const OptTable::Info InfoTable[] = {
-#define PREFIX(NAME, VALUE)
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
                HELPTEXT, METAVAR)   \
   { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, \
     FLAGS, OPT_##GROUP, OPT_##ALIAS },
 #include "clang/Driver/Options.inc"
+#undef OPTION
 };
 
 namespace {





More information about the cfe-commits mailing list