Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit b17a2c1

Browse files
committed
Option parsing tables: remove some unnecessary #defines
Also make some strings static and add missing #undef's git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186518 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 215c57f commit b17a2c1

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

Diff for: include/clang/Driver/CC1AsOptions.h

-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ namespace driver {
2222
namespace cc1asoptions {
2323
enum ID {
2424
OPT_INVALID = 0, // This is not an option ID.
25-
#define PREFIX(NAME, VALUE)
2625
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
2726
HELPTEXT, METAVAR) OPT_##ID,
2827
#include "clang/Driver/CC1AsOptions.inc"
2928
LastOption
3029
#undef OPTION
31-
#undef PREFIX
3230
};
3331
}
3432

Diff for: include/clang/Driver/Options.h

-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ enum ClangFlags {
3434

3535
enum ID {
3636
OPT_INVALID = 0, // This is not an option ID.
37-
#define PREFIX(NAME, VALUE)
3837
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
3938
HELPTEXT, METAVAR) OPT_##ID,
4039
#include "clang/Driver/Options.inc"
4140
LastOption
4241
#undef OPTION
43-
#undef PREFIX
4442
};
4543
}
4644

Diff for: lib/Driver/CC1AsOptions.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ using namespace clang::driver;
1616
using namespace llvm::opt;
1717
using namespace clang::driver::cc1asoptions;
1818

19-
#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
20-
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
21-
HELPTEXT, METAVAR)
19+
#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
2220
#include "clang/Driver/CC1AsOptions.inc"
23-
#undef OPTION
2421
#undef PREFIX
2522

2623
static const OptTable::Info CC1AsInfoTable[] = {
27-
#define PREFIX(NAME, VALUE)
2824
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
2925
HELPTEXT, METAVAR) \
3026
{ PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, \
3127
FLAGS, OPT_##GROUP, OPT_##ALIAS },
3228
#include "clang/Driver/CC1AsOptions.inc"
29+
#undef OPTION
3330
};
3431

3532
namespace {

Diff for: lib/Driver/DriverOptions.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ using namespace clang::driver;
1616
using namespace clang::driver::options;
1717
using namespace llvm::opt;
1818

19-
#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
20-
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
21-
HELPTEXT, METAVAR)
19+
#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
2220
#include "clang/Driver/Options.inc"
23-
#undef OPTION
2421
#undef PREFIX
2522

2623
static const OptTable::Info InfoTable[] = {
27-
#define PREFIX(NAME, VALUE)
2824
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
2925
HELPTEXT, METAVAR) \
3026
{ PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, Option::KIND##Class, PARAM, \
3127
FLAGS, OPT_##GROUP, OPT_##ALIAS },
3228
#include "clang/Driver/Options.inc"
29+
#undef OPTION
3330
};
3431

3532
namespace {

0 commit comments

Comments
 (0)