[llvm] 1236dbc - [ms] [llvm-ml] Allow the /Zs parameter as a synonym for -filetype=null

Eric Astor via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 09:19:09 PDT 2021


Author: Eric Astor
Date: 2021-03-17T12:18:43-04:00
New Revision: 1236dbc2fadfc0466a0a62eb147cdd3565c4898d

URL: https://github.com/llvm/llvm-project/commit/1236dbc2fadfc0466a0a62eb147cdd3565c4898d
DIFF: https://github.com/llvm/llvm-project/commit/1236dbc2fadfc0466a0a62eb147cdd3565c4898d.diff

LOG: [ms] [llvm-ml] Allow the /Zs parameter as a synonym for -filetype=null

For ml.exe, /Zs implies a syntax check with no output files.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D90061

Added: 
    llvm/test/tools/llvm-ml/parse_only.asm
    llvm/test/tools/llvm-ml/parse_only_errors.asm

Modified: 
    llvm/tools/llvm-ml/Opts.td

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-ml/parse_only.asm b/llvm/test/tools/llvm-ml/parse_only.asm
new file mode 100644
index 000000000000..0105d350fcf9
--- /dev/null
+++ b/llvm/test/tools/llvm-ml/parse_only.asm
@@ -0,0 +1,18 @@
+; RUN: llvm-ml %s /Zs /Fo - | FileCheck %s
+
+.code
+
+t1 PROC
+  ECHO Testing!
+  ret
+t1 ENDP
+
+; check for the .text symbol (appears in both object files & .s output)
+; CHECK-NOT: .text
+
+; CHECK: Testing!
+
+; check for the .text symbol (appears in both object files & .s output)
+; CHECK-NOT: .text
+
+end

diff  --git a/llvm/test/tools/llvm-ml/parse_only_errors.asm b/llvm/test/tools/llvm-ml/parse_only_errors.asm
new file mode 100644
index 000000000000..fbaed93edea0
--- /dev/null
+++ b/llvm/test/tools/llvm-ml/parse_only_errors.asm
@@ -0,0 +1,18 @@
+; RUN: not llvm-ml %s /Zs /Fo - 2>&1 | FileCheck %s
+
+.code
+
+t1 PROC
+  blah
+  ret
+t1 ENDP
+
+; check for the .text symbol (appears in both object files & .s output)
+; CHECK-NOT: .text
+
+; CHECK: error: invalid instruction mnemonic 'blah'
+
+; check for the .text symbol (appears in both object files & .s output)
+; CHECK-NOT: .text
+
+end

diff  --git a/llvm/tools/llvm-ml/Opts.td b/llvm/tools/llvm-ml/Opts.td
index 4c2757b05722..a78072007e92 100644
--- a/llvm/tools/llvm-ml/Opts.td
+++ b/llvm/tools/llvm-ml/Opts.td
@@ -27,25 +27,6 @@ class UnsupportedJoinedOrSeparate<string name> :
 class UnsupportedSeparate<string name> : Separate<["/", "-"], name>,
                                          Group<unsupported_Group>;
 
-def help : MLFlag<"?">,
-           HelpText<"Display available options">;
-def help_long : MLFlag<"help">, Alias<help>;
-def assemble_only : MLFlag<"c">, HelpText<"Assemble only; do not link">;
-def define : MLJoinedOrSeparate<"D">, MetaVarName<"<macro>=<value>">,
-             HelpText<"Define <macro> to <value> (or blank if <value> "
-                      "omitted)">;
-def output_file : MLJoinedOrSeparate<"Fo">, HelpText<"Names the output file">;
-def include_path : MLJoinedOrSeparate<"I">,
-                   HelpText<"Sets path for include files">;
-def safeseh : MLFlag<"safeseh">,
-              HelpText<"Mark resulting object files as either containing no "
-                       "exception handlers or containing exception handlers "
-                       "that are all declared with .SAFESEH. Only available in "
-                       "32-bit.">;
-def assembly_file : MLJoinedOrSeparate<"Ta">,
-                    HelpText<"Assemble source file with name not ending with "
-                             "the .asm extension">;
-
 def bitness : LLVMJoined<"m">, Values<"32,64">,
               HelpText<"Target platform (x86 or x86-64)">;
 def as_lex : LLVMFlag<"as-lex">,
@@ -69,6 +50,27 @@ def preserve_comments : LLVMFlag<"preserve-comments">,
 def save_temp_labels : LLVMFlag<"save-temp-labels">,
                        HelpText<"Don't discard temporary labels">;
 
+def help : MLFlag<"?">,
+           HelpText<"Display available options">;
+def help_long : MLFlag<"help">, Alias<help>;
+def assemble_only : MLFlag<"c">, HelpText<"Assemble only; do not link">;
+def define : MLJoinedOrSeparate<"D">, MetaVarName<"<macro>=<value>">,
+             HelpText<"Define <macro> to <value> (or blank if <value> "
+                      "omitted)">;
+def output_file : MLJoinedOrSeparate<"Fo">, HelpText<"Names the output file">;
+def include_path : MLJoinedOrSeparate<"I">,
+                   HelpText<"Sets path for include files">;
+def safeseh : MLFlag<"safeseh">,
+              HelpText<"Mark resulting object files as either containing no "
+                       "exception handlers or containing exception handlers "
+                       "that are all declared with .SAFESEH. Only available in "
+                       "32-bit.">;
+def assembly_file : MLJoinedOrSeparate<"Ta">,
+                    HelpText<"Assemble source file with name not ending with "
+                             "the .asm extension">;
+def parse_only : MLFlag<"Zs">, HelpText<"Run a syntax-check only">,
+                 Alias<filetype>, AliasArgs<["null"]>;
+
 def tiny_model_support : UnsupportedFlag<"AT">, HelpText<"">;
 def alternate_linker : UnsupportedJoined<"Bl">, HelpText<"">;
 def coff_object_file : UnsupportedFlag<"coff">, HelpText<"">;
@@ -107,4 +109,3 @@ def export_all_symbols : UnsupportedFlag<"Zf">, HelpText<"">;
 def codeview_info : UnsupportedFlag<"Zi">, HelpText<"">;
 def enable_m510_option : UnsupportedFlag<"Zm">, HelpText<"">;
 def structure_packing : UnsupportedJoined<"Zp">, HelpText<"">;
-def parse_only : UnsupportedFlag<"Zs">, HelpText<"">;


        


More information about the llvm-commits mailing list