[PATCH] D126425: [llvm-ml] Add support for the .S extension

Alan Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 15:27:57 PDT 2022


ayzhao updated this revision to Diff 432138.
ayzhao added a comment.

fix commit message


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126425/new/

https://reviews.llvm.org/D126425

Files:
  llvm/test/tools/llvm-ml/invalid_file_extension.blah
  llvm/test/tools/llvm-ml/lit.local.cfg
  llvm/test/tools/llvm-ml/valid_file_extension.S
  llvm/tools/llvm-ml/Opts.td
  llvm/tools/llvm-ml/llvm-ml.cpp


Index: llvm/tools/llvm-ml/llvm-ml.cpp
===================================================================
--- llvm/tools/llvm-ml/llvm-ml.cpp
+++ llvm/tools/llvm-ml/llvm-ml.cpp
@@ -208,7 +208,9 @@
   std::string InputFilename;
   for (auto *Arg : InputArgs.filtered(OPT_INPUT)) {
     std::string ArgString = Arg->getAsString(InputArgs);
-    if (ArgString == "-" || StringRef(ArgString).endswith(".asm")) {
+    StringRef ArgStringRef(ArgString);
+    if (ArgString == "-" || ArgStringRef.endswith(".asm") ||
+        ArgStringRef.endswith(".S")) {
       if (!InputFilename.empty()) {
         WithColor::warning(errs(), ProgName)
             << "does not support multiple assembly files in one command; "
Index: llvm/tools/llvm-ml/Opts.td
===================================================================
--- llvm/tools/llvm-ml/Opts.td
+++ llvm/tools/llvm-ml/Opts.td
@@ -31,7 +31,7 @@
 def bitness : LLVMJoined<"m">, Values<"32,64">,
               HelpText<"Target platform (x86 or x86-64)">;
 def as_lex : LLVMFlag<"as-lex">,
-             HelpText<"Lex tokens from a .asm file without assembling">;
+             HelpText<"Lex tokens from an .asm or .S file without assembling">;
 def debug : LLVMFlag<"debug">, Flags<[HelpHidden]>,
             HelpText<"Enable debug output">;
 def debug_only : LLVMCommaJoined<"debug-only=">, Flags<[HelpHidden]>,
@@ -82,7 +82,7 @@
                        "32-bit.">;
 def assembly_file : MLJoinedOrSeparate<"Ta">,
                     HelpText<"Assemble source file with name not ending with "
-                             "the .asm extension">;
+                             "the .asm or the .S extension">;
 def error_on_warning : MLFlag<"WX">, Alias<fatal_warnings>;
 def parse_only : MLFlag<"Zs">, HelpText<"Run a syntax-check only">,
                  Alias<filetype>, AliasArgs<["null"]>;
Index: llvm/test/tools/llvm-ml/valid_file_extension.S
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/valid_file_extension.S
@@ -0,0 +1,5 @@
+; RUN: llvm-ml -m64 -filetype=s %s /Fo - | FileCheck %s
+
+.code
+foo:
+; CHECK: foo:
Index: llvm/test/tools/llvm-ml/lit.local.cfg
===================================================================
--- llvm/test/tools/llvm-ml/lit.local.cfg
+++ llvm/test/tools/llvm-ml/lit.local.cfg
@@ -3,3 +3,5 @@
     config.unsupported = True
 
 config.suffixes.add('.asm')
+config.suffixes.add('.S')
+config.suffixes.add('.blah')
Index: llvm/test/tools/llvm-ml/invalid_file_extension.blah
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/invalid_file_extension.blah
@@ -0,0 +1,3 @@
+; RUN: not llvm-ml %s /Fo /dev/null 2>&1 | FileCheck %s
+
+# CHECK: error: invalid option '{{.*}}invalid_file_extension.blah'
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126425.432138.patch
Type: text/x-patch
Size: 2831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220525/958aa6ee/attachment.bin>


More information about the llvm-commits mailing list