[lld] r189895 - Rename *Options.td -> <flavor>Options.td.

Rui Ueyama ruiu at google.com
Tue Sep 3 17:24:35 PDT 2013


Author: ruiu
Date: Tue Sep  3 19:24:35 2013
New Revision: 189895

URL: http://llvm.org/viewvc/llvm-project?rev=189895&view=rev
Log:
Rename *Options.td -> <flavor>Options.td.

Before this patch, name of driver implementation is not consistent with its
option table file. Specifically, LDOptions has a different prefix than
GnuLdDriver.

This patch renames option files, so that the option files have the same prefix
as the corresponding driver files.

Differential Revision: http://llvm-reviews.chandlerc.com/D1591

Added:
    lld/trunk/lib/Driver/DarwinLdOptions.td
      - copied, changed from r189891, lld/trunk/lib/Driver/DarwinOptions.td
    lld/trunk/lib/Driver/GnuLdOptions.td
      - copied, changed from r189891, lld/trunk/lib/Driver/LDOptions.td
Removed:
    lld/trunk/lib/Driver/DarwinOptions.td
    lld/trunk/lib/Driver/LDOptions.td
Modified:
    lld/trunk/lib/Driver/CMakeLists.txt
    lld/trunk/lib/Driver/DarwinLdDriver.cpp
    lld/trunk/lib/Driver/GnuLdDriver.cpp

Modified: lld/trunk/lib/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=189895&r1=189894&r2=189895&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CMakeLists.txt (original)
+++ lld/trunk/lib/Driver/CMakeLists.txt Tue Sep  3 19:24:35 2013
@@ -1,9 +1,9 @@
-set(LLVM_TARGET_DEFINITIONS LDOptions.td)
-tablegen(LLVM LDOptions.inc -gen-opt-parser-defs)
+set(LLVM_TARGET_DEFINITIONS GnuLdOptions.td)
+tablegen(LLVM GnuLdOptions.inc -gen-opt-parser-defs)
 set(LLVM_TARGET_DEFINITIONS CoreOptions.td)
 tablegen(LLVM CoreOptions.inc -gen-opt-parser-defs)
-set(LLVM_TARGET_DEFINITIONS DarwinOptions.td)
-tablegen(LLVM DarwinOptions.inc -gen-opt-parser-defs)
+set(LLVM_TARGET_DEFINITIONS DarwinLdOptions.td)
+tablegen(LLVM DarwinLdOptions.inc -gen-opt-parser-defs)
 set(LLVM_TARGET_DEFINITIONS WinLinkOptions.td)
 tablegen(LLVM WinLinkOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(DriverOptionsTableGen)

Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=189895&r1=189894&r2=189895&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Tue Sep  3 19:24:35 2013
@@ -34,29 +34,29 @@
 
 namespace {
 
-// Create enum with OPT_xxx values for each option in DarwinOptions.td
+// Create enum with OPT_xxx values for each option in DarwinLdOptions.td
 enum DarwinOpt {
   OPT_INVALID = 0,
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
                HELP, META) \
           OPT_##ID,
-#include "DarwinOptions.inc"
+#include "DarwinLdOptions.inc"
   LastOption
 #undef OPTION
 };
 
-// Create prefix string literals used in DarwinOptions.td
+// Create prefix string literals used in DarwinLdOptions.td
 #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
-#include "DarwinOptions.inc"
+#include "DarwinLdOptions.inc"
 #undef PREFIX
 
-// Create table mapping all options defined in DarwinOptions.td
+// Create table mapping all options defined in DarwinLdOptions.td
 static const llvm::opt::OptTable::Info infoTable[] = {
 #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, ALIASARGS },
-#include "DarwinOptions.inc"
+#include "DarwinLdOptions.inc"
 #undef OPTION
 };
 
@@ -89,7 +89,7 @@ bool DarwinLdDriver::linkMachO(int argc,
 
 bool DarwinLdDriver::parse(int argc, const char *argv[],
                            MachOLinkingContext &ctx, raw_ostream &diagnostics) {
-  // Parse command line options using DarwinOptions.td
+  // Parse command line options using DarwinLdOptions.td
   std::unique_ptr<llvm::opt::InputArgList> parsedArgs;
   DarwinLdOptTable table;
   unsigned missingIndex;
@@ -226,5 +226,3 @@ bool DarwinLdDriver::parse(int argc, con
 }
 
 } // namespace lld
-
-

Copied: lld/trunk/lib/Driver/DarwinLdOptions.td (from r189891, lld/trunk/lib/Driver/DarwinOptions.td)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdOptions.td?p2=lld/trunk/lib/Driver/DarwinLdOptions.td&p1=lld/trunk/lib/Driver/DarwinOptions.td&r1=189891&r2=189895&rev=189895&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinOptions.td (original)
+++ lld/trunk/lib/Driver/DarwinLdOptions.td Tue Sep  3 19:24:35 2013
@@ -3,32 +3,32 @@ include "llvm/Option/OptParser.td"
 
 // output kinds
 def grp_kind : OptionGroup<"outs">, HelpText<"OUTPUT KIND">;
-def relocatable : Flag<["-"], "r">, 
+def relocatable : Flag<["-"], "r">,
                 HelpText<"Create relocatable object file">, Group<grp_kind>;
-def static : Flag<["-"], "static">, 
+def static : Flag<["-"], "static">,
                 HelpText<"Create static executable">, Group<grp_kind>;
-def dynamic : Flag<["-"], "dynamic">, 
+def dynamic : Flag<["-"], "dynamic">,
                 HelpText<"Create dynamic executable (default)">,Group<grp_kind>;
-def dylib : Flag<["-"], "dylib">, 
+def dylib : Flag<["-"], "dylib">,
                 HelpText<"Create dynamic library">, Group<grp_kind>;
-def bundle : Flag<["-"], "bundle">, 
+def bundle : Flag<["-"], "bundle">,
                 HelpText<"Create dynamic bundle">, Group<grp_kind>;
-def execute : Flag<["-"], "execute">, 
+def execute : Flag<["-"], "execute">,
                 HelpText<"Create main executable (default)">, Group<grp_kind>;
-def preload : Flag<["-"], "preload">, 
+def preload : Flag<["-"], "preload">,
                 HelpText<"Create preload">, Group<grp_kind>;
 
 // optimizations
 def grp_opts : OptionGroup<"opts">, HelpText<"OPTIMIZATIONS">;
 def dead_strip : Flag<["-"], "dead_strip">,
                 HelpText<"Remove unreference code and data">, Group<grp_opts>;
-def macosx_version_min : Separate<["-"], "macosx_version_min">, 
+def macosx_version_min : Separate<["-"], "macosx_version_min">,
                 HelpText<"Minimum Mac OS X version">, Group<grp_opts>;
-def ios_version_min : Separate<["-"], "ios_version_min">, 
+def ios_version_min : Separate<["-"], "ios_version_min">,
                 HelpText<"Minimum iOS version">, Group<grp_opts>;
-def ios_simulator_version_min : Separate<["-"], "ios_simulator_version_min">, 
+def ios_simulator_version_min : Separate<["-"], "ios_simulator_version_min">,
                 HelpText<"Minimum iOS simulator version">, Group<grp_opts>;
-def mllvm : Separate<["-"], "mllvm">, 
+def mllvm : Separate<["-"], "mllvm">,
                 HelpText<"Options to pass to LLVM during LTO">, Group<grp_opts>;
 
 // main executable options
@@ -43,9 +43,9 @@ def grp_libs : OptionGroup<"libs">, Help
 def L : Joined<["-"], "L">,
         HelpText<"Add directory to library search path">, Group<grp_libs>;
 def all_load : Flag<["-"], "all_load">,
-        HelpText<"Forces all members of all static libraries to be loaded">, 
+        HelpText<"Forces all members of all static libraries to be loaded">,
         Group<grp_libs>;
-  
+
 
 // general options
 def output : Separate<["-"], "o">, HelpText<"Output file path">;

Removed: lld/trunk/lib/Driver/DarwinOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinOptions.td?rev=189894&view=auto
==============================================================================
--- lld/trunk/lib/Driver/DarwinOptions.td (original)
+++ lld/trunk/lib/Driver/DarwinOptions.td (removed)
@@ -1,55 +0,0 @@
-include "llvm/Option/OptParser.td"
-
-
-// output kinds
-def grp_kind : OptionGroup<"outs">, HelpText<"OUTPUT KIND">;
-def relocatable : Flag<["-"], "r">, 
-                HelpText<"Create relocatable object file">, Group<grp_kind>;
-def static : Flag<["-"], "static">, 
-                HelpText<"Create static executable">, Group<grp_kind>;
-def dynamic : Flag<["-"], "dynamic">, 
-                HelpText<"Create dynamic executable (default)">,Group<grp_kind>;
-def dylib : Flag<["-"], "dylib">, 
-                HelpText<"Create dynamic library">, Group<grp_kind>;
-def bundle : Flag<["-"], "bundle">, 
-                HelpText<"Create dynamic bundle">, Group<grp_kind>;
-def execute : Flag<["-"], "execute">, 
-                HelpText<"Create main executable (default)">, Group<grp_kind>;
-def preload : Flag<["-"], "preload">, 
-                HelpText<"Create preload">, Group<grp_kind>;
-
-// optimizations
-def grp_opts : OptionGroup<"opts">, HelpText<"OPTIMIZATIONS">;
-def dead_strip : Flag<["-"], "dead_strip">,
-                HelpText<"Remove unreference code and data">, Group<grp_opts>;
-def macosx_version_min : Separate<["-"], "macosx_version_min">, 
-                HelpText<"Minimum Mac OS X version">, Group<grp_opts>;
-def ios_version_min : Separate<["-"], "ios_version_min">, 
-                HelpText<"Minimum iOS version">, Group<grp_opts>;
-def ios_simulator_version_min : Separate<["-"], "ios_simulator_version_min">, 
-                HelpText<"Minimum iOS simulator version">, Group<grp_opts>;
-def mllvm : Separate<["-"], "mllvm">, 
-                HelpText<"Options to pass to LLVM during LTO">, Group<grp_opts>;
-
-// main executable options
-def grp_main : OptionGroup<"opts">, HelpText<"MAIN EXECUTABLE OPTIONS">;
-def entry : Separate<["-"], "e">, HelpText<"entry symbol name">,Group<grp_main>;
-
-// dylib executable options
-def grp_dylib : OptionGroup<"opts">, HelpText<"DYLIB EXECUTABLE OPTIONS">;
-
-// library options
-def grp_libs : OptionGroup<"libs">, HelpText<"LIBRARY OPTIONS">;
-def L : Joined<["-"], "L">,
-        HelpText<"Add directory to library search path">, Group<grp_libs>;
-def all_load : Flag<["-"], "all_load">,
-        HelpText<"Forces all members of all static libraries to be loaded">, 
-        Group<grp_libs>;
-  
-
-// general options
-def output : Separate<["-"], "o">, HelpText<"Output file path">;
-def arch : Separate<["-"], "arch">, HelpText<"Architecture to link">;
-
-// extras
-def help : Flag<["-"], "help">;

Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=189895&r1=189894&r2=189895&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Tue Sep  3 19:24:35 2013
@@ -36,29 +36,29 @@ using namespace lld;
 
 namespace {
 
-// Create enum with OPT_xxx values for each option in LDOptions.td
-enum LDOpt {
+// Create enum with OPT_xxx values for each option in GnuLdOptions.td
+enum GnuLdOpt {
   OPT_INVALID = 0,
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
                HELP, META) \
           OPT_##ID,
-#include "LDOptions.inc"
+#include "GnuLdOptions.inc"
   LastOption
 #undef OPTION
 };
 
-// Create prefix string literals used in LDOptions.td
+// Create prefix string literals used in GnuLdOptions.td
 #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
-#include "LDOptions.inc"
+#include "GnuLdOptions.inc"
 #undef PREFIX
 
-// Create table mapping all options defined in LDOptions.td
+// Create table mapping all options defined in GnuLdOptions.td
 static const llvm::opt::OptTable::Info infoTable[] = {
 #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, ALIASARGS },
-#include "LDOptions.inc"
+#include "GnuLdOptions.inc"
 #undef OPTION
 };
 
@@ -118,7 +118,7 @@ bool GnuLdDriver::linkELF(int argc, cons
 bool GnuLdDriver::parse(int argc, const char *argv[],
                         std::unique_ptr<ELFLinkingContext> &context,
                         raw_ostream &diagnostics) {
-  // Parse command line options using LDOptions.td
+  // Parse command line options using GnuLdOptions.td
   std::unique_ptr<llvm::opt::InputArgList> parsedArgs;
   GnuLdOptTable table;
   unsigned missingIndex;

Copied: lld/trunk/lib/Driver/GnuLdOptions.td (from r189891, lld/trunk/lib/Driver/LDOptions.td)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdOptions.td?p2=lld/trunk/lib/Driver/GnuLdOptions.td&p1=lld/trunk/lib/Driver/LDOptions.td&r1=189891&r2=189895&rev=189895&view=diff
==============================================================================
--- lld/trunk/lib/Driver/LDOptions.td (original)
+++ lld/trunk/lib/Driver/GnuLdOptions.td Tue Sep  3 19:24:35 2013
@@ -1,9 +1,9 @@
 include "llvm/Option/OptParser.td"
 
-def target : Separate<["-"], "target">,     
+def target : Separate<["-"], "target">,
     MetaVarName<"<triple>">,
     HelpText<"Target triple to link for">;
-  
+
 def mllvm : Separate<["-"], "mllvm">,
     HelpText<"Options to pass to LLVM">;
 
@@ -28,10 +28,10 @@ multiclass dashEq<string opt1, string op
 defm e : smDash<"e", "entry",
          "Name of entry point symbol">;
 
-def output : Separate<["-"], "o">, 
+def output : Separate<["-"], "o">,
     MetaVarName<"<path>">,
     HelpText<"Path to file to write output">;
-    
+
 def relocatable : Flag<["--"], "relocatable">;
 def relocatable_r : Flag<["-"], "r">, Alias<relocatable>;
 
@@ -57,10 +57,10 @@ def eh_frame_hdr : Flag<["--"], "eh-fram
 
 def help : Flag<["--"], "help">;
 
-def L : Joined<["-"], "L">, 
+def L : Joined<["-"], "L">,
     MetaVarName<"<dir>">,
     HelpText<"Directory to search for libraries">;
-def l : Joined<["-"], "l">, 
+def l : Joined<["-"], "l">,
     MetaVarName<"<libName>">,
     HelpText<"Root name of library to use">;
 def hash_style : Joined <["--"], "hash-style=">;
@@ -121,7 +121,7 @@ def sysroot : Joined<["--"], "sysroot=">
     HelpText<"Set the system root">;
 
 // extensions
-def emit_yaml : Flag<["-"], "emit-yaml">, 
+def emit_yaml : Flag<["-"], "emit-yaml">,
     HelpText<"Write YAML instead of ELF">;
 def whole_archive: Flag<["--"], "whole-archive">,
     HelpText<"Force load of all members in a static library">;

Removed: lld/trunk/lib/Driver/LDOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/LDOptions.td?rev=189894&view=auto
==============================================================================
--- lld/trunk/lib/Driver/LDOptions.td (original)
+++ lld/trunk/lib/Driver/LDOptions.td (removed)
@@ -1,132 +0,0 @@
-include "llvm/Option/OptParser.td"
-
-def target : Separate<["-"], "target">,     
-    MetaVarName<"<triple>">,
-    HelpText<"Target triple to link for">;
-  
-def mllvm : Separate<["-"], "mllvm">,
-    HelpText<"Options to pass to LLVM">;
-
-// Single and multiple dash options combined
-multiclass smDash<string opt1, string opt2, string help> {
-  def "" : Separate<["-"], opt1>, HelpText<help>;
-  def opt1_eq : Separate<["-"], opt1#"=">,
-      Alias<!cast<Option>(opt1)>;
-  def opt2_dashdash : Separate<["--"], opt2>,
-      Alias<!cast<Option>(opt1)>;
-  def opt2_dashdash_eq : Separate<["--"], opt2#"=">,
-      Alias<!cast<Option>(opt1)>;
-}
-
-// Support -<option>,-<option>=
-multiclass dashEq<string opt1, string opt2, string help> {
-  def "" : Separate<["-"], opt1>, HelpText<help>;
-  def opt2_eq : Separate<["-"], opt2#"=">,
-      Alias<!cast<Option>(opt1)>;
-}
-
-defm e : smDash<"e", "entry",
-         "Name of entry point symbol">;
-
-def output : Separate<["-"], "o">, 
-    MetaVarName<"<path>">,
-    HelpText<"Path to file to write output">;
-    
-def relocatable : Flag<["--"], "relocatable">;
-def relocatable_r : Flag<["-"], "r">, Alias<relocatable>;
-
-def dynamic_linker : Joined<["--"], "dynamic-linker=">,
-    HelpText<"Set the path to the dynamic linker">;
-def dynamic_linker_alias : Separate<["-"], "dynamic-linker">,
-    Alias<dynamic_linker>;
-
-def m : Separate<["-"], "m">;
-def z : Separate<["-"], "z">;
-def t : Flag<["-"], "t">;
-def rpath : Separate<["-"], "rpath">;
-def rpath_link : Separate<["-"], "rpath-link">;
-def soname : Separate<["-"], "soname">;
-
-def static : Flag<["-"], "static">;
-def shared : Flag<["-"], "shared">;
-def Bshareable : Flag<["-"], "Bshareable">, Alias<shared>;
-def start_group : Flag<["--"], "start-group">;
-def end_group : Flag<["--"], "end-group">;
-def build_id : Flag<["--"], "build-id">;
-def eh_frame_hdr : Flag<["--"], "eh-frame-hdr">;
-
-def help : Flag<["--"], "help">;
-
-def L : Joined<["-"], "L">, 
-    MetaVarName<"<dir>">,
-    HelpText<"Directory to search for libraries">;
-def l : Joined<["-"], "l">, 
-    MetaVarName<"<libName>">,
-    HelpText<"Root name of library to use">;
-def hash_style : Joined <["--"], "hash-style=">;
-
-def noinhibit_exec : Flag<["--"], "noinhibit-exec">,
-    HelpText<"Retain the executable output file whenever"
-             " it is still usable">;
-
-def merge_strings : Flag<["--"], "merge-strings">,
-    HelpText<"Merge common strings across mergeable sections">;
-
-
-def no_allow_shlib_undefs : Flag<["--"], "no-allow-shlib-undefined">,
-    HelpText<"Do not allow undefined symbols from dynamic"
-             " library when creating executables">;
-
-def allow_shlib_undefs : Flag<["--"], "allow-shlib-undefined">,
-    HelpText<"Allow undefined symbols from dynamic"
-             " library when creating executables">;
-
-def use_shlib_undefs: Flag<["--"], "use-shlib-undefines">,
-    HelpText<"Resolve undefined symbols from dynamic libraries">;
-
-def nmagic : Flag<["--"], "nmagic">,
-    HelpText<"Turn off page alignment of sections,"
-             " and disable linking against shared libraries">;
-def nmagic_alias : Flag<["-"], "n">, Alias<nmagic>;
-
-def omagic : Flag<["--"], "omagic">,
-    HelpText<"Set the text and data sections to be readable and writable."
-             " Also, do not page-align the data segment, and"
-             " disable linking against shared libraries.">;
-
-def omagic_alias : Flag<["-"], "N">, Alias<omagic>;
-
-def no_omagic : Flag<["--"], "no-omagic">,
-    HelpText<"This option negates most of the effects of the -N option."
-             "Disable linking with shared libraries">;
-
-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">;
-def no_as_needed : Flag<["--"], "no-as-needed">,
-    HelpText<"This option restores the default behavior"
-             " of adding DT_NEEDED entries">;
-
-defm init: dashEq<"init", "init",
-                 "Specify an initializer function">;
-
-defm fini: dashEq<"fini", "fini",
-                 "Specify a finalizer function">;
-
-def sysroot : Joined<["--"], "sysroot=">,
-    HelpText<"Set the system root">;
-
-// extensions
-def emit_yaml : Flag<["-"], "emit-yaml">, 
-    HelpText<"Write YAML instead of ELF">;
-def whole_archive: Flag<["--"], "whole-archive">,
-    HelpText<"Force load of all members in a static library">;
-def no_whole_archive: Flag<["--"], "no-whole-archive">,
-    HelpText<"Restores the default behavior of loading archive members">;
-
-def all_load : Flag<["-"], "all_load">,
-        HelpText<"Forces all members of all static libraries to be loaded">;





More information about the llvm-commits mailing list