[PATCH] D44394: [WebAssembly] Use helper macro from ELF/Options.td to tidy. NFC

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 10:02:23 PDT 2018


ncw created this revision.
ncw added reviewers: sbc100, ruiu.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44394

Files:
  wasm/Options.td


Index: wasm/Options.td
===================================================================
--- wasm/Options.td
+++ wasm/Options.td
@@ -11,6 +11,11 @@
   def _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
 }
 
+multiclass B<string name, string help1, string help2> {
+  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
+  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
+}
+
 // The follow flags are shared with the ELF linker
 def color_diagnostics: F<"color-diagnostics">,
   HelpText<"Use colors in diagnostics">;
@@ -27,8 +32,9 @@
 def fatal_warnings: F<"fatal-warnings">,
   HelpText<"Treat warnings as errors">;
 
-def gc_sections: F<"gc-sections">,
-  HelpText<"Enable garbage collection of unused sections">;
+defm gc_sections: B<"gc-sections",
+    "Enable garbage collection of unused sections",
+    "Disable garbage collection of unused sections">;
 
 def help: F<"help">, HelpText<"Print option help">;
 
@@ -48,17 +54,12 @@
 
 def no_fatal_warnings: F<"no-fatal-warnings">;
 
-def no_gc_sections: F<"no-gc-sections">,
-  HelpText<"Disable garbage collection of unused sections">;
-
-def no_print_gc_sections: F<"no-print-gc-sections">,
-  HelpText<"Do not list removed unused sections">;
-
 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
   HelpText<"Path to file to write output">;
 
-def print_gc_sections: F<"print-gc-sections">,
-  HelpText<"List removed unused sections">;
+defm print_gc_sections: B<"print-gc-sections",
+    "List removed unused sections",
+    "Do not list removed unused sections">;
 
 def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
 
@@ -91,8 +92,9 @@
 def allow_undefined_file_s: Separate<["-"], "allow-undefined-file">,
   Alias<allow_undefined_file>;
 
-def check_signatures: F<"check-signatures">,
-  HelpText<"Check function signatures">;
+defm check_signatures: B<"check-signatures",
+    "Check function signatures",
+    "Don't check function signatures">;
 
 defm export: Eq<"export">,
   HelpText<"Force a symbol to be exported">;
@@ -109,9 +111,6 @@
 def max_memory: J<"max-memory=">,
   HelpText<"Maximum size of the linear memory">;
 
-def no_check_signatures: F<"no-check-signatures">,
-  HelpText<"Don't check function signatures">;
-
 def no_entry: F<"no-entry">,
   HelpText<"Do not output any entry point">;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44394.138042.patch
Type: text/x-patch
Size: 2354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180312/b7cf884d/attachment.bin>


More information about the llvm-commits mailing list