diff options
Diffstat (limited to 'llvm/tools/llvm-rc/llvm-rc.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/llvm-rc.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp index 00fb9c1..f7f9ce2 100644 --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -55,7 +55,11 @@ enum ID { #undef OPTION }; -#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE; +namespace rc_opt { +#define PREFIX(NAME, VALUE) \ + static constexpr StringLiteral NAME##_init[] = VALUE; \ + static constexpr ArrayRef<StringLiteral> NAME(NAME##_init, \ + std::size(NAME##_init) - 1); #include "Opts.inc" #undef PREFIX @@ -70,10 +74,11 @@ static constexpr opt::OptTable::Info InfoTable[] = { #include "Opts.inc" #undef OPTION }; +} // namespace rc_opt class RcOptTable : public opt::OptTable { public: - RcOptTable() : OptTable(InfoTable, /* IgnoreCase = */ true) {} + RcOptTable() : OptTable(rc_opt::InfoTable, /* IgnoreCase = */ true) {} }; enum Windres_ID { @@ -85,25 +90,30 @@ enum Windres_ID { #undef OPTION }; -#define PREFIX(NAME, VALUE) const char *const WINDRES_##NAME[] = VALUE; +namespace windres_opt { +#define PREFIX(NAME, VALUE) \ + static constexpr StringLiteral NAME##_init[] = VALUE; \ + static constexpr ArrayRef<StringLiteral> NAME(NAME##_init, \ + std::size(NAME##_init) - 1); #include "WindresOpts.inc" #undef PREFIX -static constexpr opt::OptTable::Info WindresInfoTable[] = { +static constexpr opt::OptTable::Info InfoTable[] = { #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ HELPTEXT, METAVAR, VALUES) \ - { \ - WINDRES_##PREFIX, NAME, HELPTEXT, \ - METAVAR, WINDRES_##ID, opt::Option::KIND##Class, \ - PARAM, FLAGS, WINDRES_##GROUP, \ - WINDRES_##ALIAS, ALIASARGS, VALUES}, + {PREFIX, NAME, HELPTEXT, \ + METAVAR, WINDRES_##ID, opt::Option::KIND##Class, \ + PARAM, FLAGS, WINDRES_##GROUP, \ + WINDRES_##ALIAS, ALIASARGS, VALUES}, #include "WindresOpts.inc" #undef OPTION }; +} // namespace windres_opt class WindresOptTable : public opt::OptTable { public: - WindresOptTable() : OptTable(WindresInfoTable, /* IgnoreCase = */ false) {} + WindresOptTable() + : OptTable(windres_opt::InfoTable, /* IgnoreCase = */ false) {} }; static ExitOnError ExitOnErr; |