[lld] r191223 - [PECOFF] Simplify WinLinkOptions.td.

Rui Ueyama ruiu at google.com
Mon Sep 23 13:36:39 PDT 2013


Author: ruiu
Date: Mon Sep 23 15:36:39 2013
New Revision: 191223

URL: http://llvm.org/viewvc/llvm-project?rev=191223&view=rev
Log:
[PECOFF] Simplify WinLinkOptions.td.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/Driver/WinLinkOptions.td

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=191223&r1=191222&r2=191223&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Mon Sep 23 15:36:39 2013
@@ -409,7 +409,7 @@ bool WinLinkDriver::parse(int argc, cons
       ctx.setDeadStripping(false);
       break;
 
-    case OPT_no_nxcompat:
+    case OPT_nxcompat_no:
       // handle /nxcompat:no
       ctx.setNxCompat(false);
       break;
@@ -432,7 +432,7 @@ bool WinLinkDriver::parse(int argc, cons
       ctx.setDynamicBaseEnabled(false);
       break;
 
-    case OPT_no_dynamicbase:
+    case OPT_dynamicbase_no:
       // handle /dynamicbase:no
       ctx.setDynamicBaseEnabled(false);
       break;
@@ -442,7 +442,7 @@ bool WinLinkDriver::parse(int argc, cons
       ctx.setTerminalServerAware(true);
       break;
 
-    case OPT_no_tsaware:
+    case OPT_tsaware_no:
       // handle /tsaware:no
       ctx.setTerminalServerAware(false);
       break;

Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=191223&r1=191222&r2=191223&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Mon Sep 23 15:36:39 2013
@@ -2,13 +2,21 @@ include "llvm/Option/OptParser.td"
 
 // link.exe accepts options starting with either a dash or a slash.
 
+// Flag that takes no arguments.
 class F<string name> : Flag<["/", "-", "-?"], name>;
 
+// Flag that takes one argument after ":".
 multiclass P<string name, string help> {
   def "" : Joined<["/", "-", "-?"], name#":">, HelpText<help>;
   def _c : Separate<["/", "-", "-?"], name>, Alias<!cast<Option>(name)>;
 }
 
+// Boolean flag suffixed by ":no".
+multiclass B<string name, string help> {
+  def "" : F<name>;
+  def _no : F<name#":no">, HelpText<help>;
+}
+
 defm base    : P<"base", "Base address of the program">;
 defm defaultlib : P<"defaultlib", "Add the library to the list of input files">;
 defm entry   : P<"entry", "Name of entry point symbol">;
@@ -39,23 +47,12 @@ def ref : F<"opt:ref">;
 def no_ref : F<"opt:noref">,
     HelpText<"Keep unreferenced symbols to be included to the output">;
 
-def nxcompat : F<"nxcompat">;
-def no_nxcompat : F<"nxcompat:no">,
-    HelpText<"Disable data execution provention">;
-
-def largeaddressaware : F<"largeaddressaware">;
-def no_largeaddressaware : F<"largeaddressaware:no">,
-    HelpText<"Disable large addresses">;
-
-def fixed : F<"fixed">;
-def no_fixed : F<"fixed:no">, HelpText<"Enable base relocations">;
-
-def dynamicbase : F<"dynamicbase">;
-def no_dynamicbase : F<"dynamicbase:no">, HelpText<"Disable address space layout randomization">;
-
-def tsaware : F<"tsaware">;
-def no_tsaware : F<"tsaware:no">,
-    HelpText<"Create non-Terminal Server aware executable">;
+defm nxcompat : B<"nxcompat", "Disable data execution provention">;
+defm largeaddressaware : B<"largeaddressaware", "Disable large addresses">;
+defm fixed    : B<"fixed", "Enable base relocations">;
+defm tsaware  : B<"tsaware", "Create non-Terminal Server aware executable">;
+defm dynamicbase : B<"dynamicbase",
+     "Disable address space layout randomization">;
 
 def help : F<"help">;
 def help_q : F<"?">, Alias<help>;





More information about the llvm-commits mailing list