[PATCH] D43408: Do not print out "no input files" twice.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 14:52:35 PST 2018


ruiu updated this revision to Diff 134732.
ruiu added a comment.

- added a test


https://reviews.llvm.org/D43408

Files:
  lld/test/wasm/driver.ll
  lld/wasm/Driver.cpp


Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -211,9 +211,6 @@
       break;
     }
   }
-
-  if (Files.empty())
-    error("no input files");
 }
 
 static StringRef getEntry(opt::InputArgList &Args, StringRef Default) {
@@ -280,12 +277,14 @@
   if (auto *Arg = Args.getLastArg(OPT_allow_undefined_file))
     readImportFile(Arg->getValue());
 
+  if (!Args.hasArg(OPT_INPUT)) {
+    error("no input files");
+    return;
+  }
+
   if (Config->OutputFile.empty())
     error("no output file specified");
 
-  if (!Args.hasArg(OPT_INPUT))
-    error("no input files");
-
   if (Config->Relocatable) {
     if (!Config->Entry.empty())
       error("entry point specified for relocatable output file");
Index: lld/test/wasm/driver.ll
===================================================================
--- /dev/null
+++ lld/test/wasm/driver.ll
@@ -0,0 +1,18 @@
+; RUN: llc -filetype=obj %s -o %t.o
+
+target triple = "wasm32-unknown-unknown-wasm"
+
+define hidden void @entry() local_unnamed_addr #0 {
+entry:
+  ret void
+}
+
+; RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s
+; IN: error: no input files
+
+; RUN: not wasm-ld %t.o 2>&1 | FileCheck -check-prefix=OUT %s
+; OUT: error: no output file specified
+
+; RUN: not wasm-ld 2>&1 | FileCheck -check-prefix=BOTH %s
+; BOTH:     error: no input files
+; BOTH-NOT: error: no output file specified


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43408.134732.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/0f0968ea/attachment.bin>


More information about the llvm-commits mailing list