From 0f2a45cac5457698d3d97ae0ac470a92f876f86a Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Sun, 25 Aug 2013 18:05:15 +0000 Subject: [PATCH] [lld][ELF][Cleanup] Create multiclass for variations in options usage llvm-svn: 189197 --- lld/lib/Driver/GnuLdDriver.cpp | 2 +- lld/lib/Driver/LDOptions.td | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp index 4cd0d52d2728..7060da11747e 100644 --- a/lld/lib/Driver/GnuLdDriver.cpp +++ b/lld/lib/Driver/GnuLdDriver.cpp @@ -170,7 +170,7 @@ bool GnuLdDriver::parse(int argc, const char *argv[], ctx->setAllowShlibUndefines(true); ctx->setUseShlibUndefines(false); break; - case OPT_entry: + case OPT_e: ctx->setEntrySymbolName(inputArg->getValue()); break; diff --git a/lld/lib/Driver/LDOptions.td b/lld/lib/Driver/LDOptions.td index 8f5a87996df9..f95f7b1484e5 100644 --- a/lld/lib/Driver/LDOptions.td +++ b/lld/lib/Driver/LDOptions.td @@ -6,10 +6,16 @@ def target : Separate<["-"], "target">, def mllvm : Separate<["-"], "mllvm">, HelpText<"Options to pass to LLVM">; +// Single and multiple dash options combined +multiclass smDash { + def "" : Separate<["-"], opt1>, HelpText; + def opt1_eq : Separate<["-"], opt1#"=">, Alias(opt1)>; + def opt2_dashdash : Separate<["--"], opt2>, Alias(opt1)>; + def opt2_dashdash_eq : Separate<["--"], opt2#"=">, Alias(opt1)>; +} -def entry : Joined<["--"], "entry=">, - HelpText<"Name of entry point symbol">; -def entry_e : Separate<["-"], "e">, Alias; +defm e : smDash<"e", "entry", + "Name of entry point symbol">; def output : Separate<["-"], "o">, MetaVarName<"">, @@ -72,13 +78,8 @@ def omagic_alias : Flag<["-"], "N">, Alias; def no_omagic : Flag<["--"], "no-omagic">, HelpText<"This option negates most of the effects of the -N option. Disable linking with shared libraries">; -// TODO: remove the options with the = sign, once the change in the OptionParser -// is done to recognize the allowed suffixes for an argument. -def u : Separate<["-"], "u">, - HelpText<"Force symbol to be entered in the output file as an undefined symbol">; -def undefined : Separate<["--"], "undefined">, Alias; -def u_equal : Joined<["-"], "u=">, Alias; -def undefined_equal : Joined<["--"], "undefined=">, Alias; +defm u : smDash<"u", "undefined", + "Force symbol to be entered in the output file as an undefined symbol">; def as_needed : Flag<["--"], "as-needed">, HelpText<"This option affects ELF DT_NEEDED tags for dynamic libraries mentioned on the command line">;