Do not print out "no input files" twice.

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

llvm-svn: 325406
diff --git a/lld/test/wasm/driver.ll b/lld/test/wasm/driver.ll
new file mode 100644
index 0000000..10a8eca
--- /dev/null
+++ b/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
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index 2358aa4..8d909ec 100644
--- a/lld/wasm/Driver.cpp
+++ b/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");