[lld] r187541 - Option parsing tables: pick up AliasArgs from the OPTION macro.

Rui Ueyama ruiu at google.com
Wed Jul 31 16:27:01 PDT 2013


LGTM. We should probably eliminate this code duplication from LLD.


On Wed, Jul 31, 2013 at 4:17 PM, Hans Wennborg <hans at hanshq.net> wrote:

> Author: hans
> Date: Wed Jul 31 18:17:41 2013
> New Revision: 187541
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187541&view=rev
> Log:
> Option parsing tables: pick up AliasArgs from the OPTION macro.
>
> This depends on LLVM r187537.
>
> The SUPPORT_ALIASARGS macro will be removed once all option parsing
> clients have been updated.
>
> Modified:
>     lld/trunk/lib/Driver/CoreDriver.cpp
>     lld/trunk/lib/Driver/DarwinLdDriver.cpp
>     lld/trunk/lib/Driver/GnuLdDriver.cpp
>     lld/trunk/lib/Driver/WinLinkDriver.cpp
>
> Modified: lld/trunk/lib/Driver/CoreDriver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=187541&r1=187540&r2=187541&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Driver/CoreDriver.cpp (original)
> +++ lld/trunk/lib/Driver/CoreDriver.cpp Wed Jul 31 18:17:41 2013
> @@ -29,10 +29,13 @@ using namespace lld;
>
>  namespace {
>
> +#define SUPPORT_ALIASARGS // FIXME: Remove when no longer necessary.
> +
>  // Create enum with OPT_xxx values for each option in DarwinOptions.td
>  enum CoreOpt {
>    OPT_INVALID = 0,
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, HELP,
> META) \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
> +               HELP, META) \
>            OPT_##ID,
>  #include "CoreOptions.inc"
>    LastOption
> @@ -46,10 +49,10 @@ enum CoreOpt {
>
>  // Create table mapping all options defined in CoreOptions.td
>  static const llvm::opt::OptTable::Info infoTable[] = {
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
>                 HELPTEXT, METAVAR)   \
>    { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID,
> llvm::opt::Option::KIND##Class, \
> -    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS },
> +    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS },
>  #include "CoreOptions.inc"
>  #undef OPTION
>  };
>
> Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=187541&r1=187540&r2=187541&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
> +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Jul 31 18:17:41 2013
> @@ -34,10 +34,13 @@
>
>  namespace {
>
> +#define SUPPORT_ALIASARGS // FIXME: Remove when no longer necessary.
> +
>  // Create enum with OPT_xxx values for each option in DarwinOptions.td
>  enum DarwinOpt {
>    OPT_INVALID = 0,
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, HELP,
> META) \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
> +               HELP, META) \
>            OPT_##ID,
>  #include "DarwinOptions.inc"
>    LastOption
> @@ -51,10 +54,10 @@ enum DarwinOpt {
>
>  // Create table mapping all options defined in DarwinOptions.td
>  static const llvm::opt::OptTable::Info infoTable[] = {
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
>                 HELPTEXT, METAVAR)   \
>    { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID,
> llvm::opt::Option::KIND##Class, \
> -    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS },
> +    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS },
>  #include "DarwinOptions.inc"
>  #undef OPTION
>  };
>
> Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=187541&r1=187540&r2=187541&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
> +++ lld/trunk/lib/Driver/GnuLdDriver.cpp Wed Jul 31 18:17:41 2013
> @@ -36,10 +36,13 @@ using namespace lld;
>
>  namespace {
>
> +#define SUPPORT_ALIASARGS // FIXME: Remove when no longer necessary.
> +
>  // Create enum with OPT_xxx values for each option in LDOptions.td
>  enum LDOpt {
>    OPT_INVALID = 0,
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, HELP,
> META) \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
> +               HELP, META) \
>            OPT_##ID,
>  #include "LDOptions.inc"
>    LastOption
> @@ -53,10 +56,10 @@ enum LDOpt {
>
>  // Create table mapping all options defined in LDOptions.td
>  static const llvm::opt::OptTable::Info infoTable[] = {
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
>                 HELPTEXT, METAVAR)   \
>    { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID,
> llvm::opt::Option::KIND##Class, \
> -    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS },
> +    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS },
>  #include "LDOptions.inc"
>  #undef OPTION
>  };
>
> Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=187541&r1=187540&r2=187541&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
> +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Wed Jul 31 18:17:41 2013
> @@ -30,10 +30,13 @@ namespace lld {
>
>  namespace {
>
> +#define SUPPORT_ALIASARGS // FIXME: Remove when no longer necessary.
> +
>  // Create enum with OPT_xxx values for each option in WinLinkOptions.td
>  enum WinLinkOpt {
>    OPT_INVALID = 0,
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, HELP,
> META) \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
> +               HELP, META) \
>            OPT_##ID,
>  #include "WinLinkOptions.inc"
>    LastOption
> @@ -47,10 +50,10 @@ enum WinLinkOpt {
>
>  // Create table mapping all options defined in WinLinkOptions.td
>  static const llvm::opt::OptTable::Info infoTable[] = {
> -#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
> +#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS,
> PARAM, \
>                 HELPTEXT, METAVAR)   \
>    { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID,
> llvm::opt::Option::KIND##Class, \
> -    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS },
> +    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS, ALIASARGS },
>  #include "WinLinkOptions.inc"
>  #undef OPTION
>  };
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130731/825d48fb/attachment.html>


More information about the llvm-commits mailing list