From 6f750292da7ccc66cffd6d51767d7f135bbc8392 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 13 Apr 2016 19:36:04 +0000 Subject: [PATCH] LibDriver: Silently do nothing when provided no inputs. This behavior is strange, but it matches lib.exe. Based on a patch by Nico Weber. Fixes PR27335. llvm-svn: 266236 --- lib/LibDriver/LibDriver.cpp | 4 ++-- test/LibDriver/no-inputs.test | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 test/LibDriver/no-inputs.test diff --git a/lib/LibDriver/LibDriver.cpp b/lib/LibDriver/LibDriver.cpp index 3ae54346074..671cc73c576 100644 --- a/lib/LibDriver/LibDriver.cpp +++ b/lib/LibDriver/LibDriver.cpp @@ -122,8 +122,8 @@ int llvm::libDriverMain(llvm::ArrayRef ArgsArr) { llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n"; if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end()) { - llvm::errs() << "no input files.\n"; - return 1; + // No input files. To match lib.exe, silently do nothing. + return 0; } std::vector SearchPaths = getSearchPaths(&Args, Saver); diff --git a/test/LibDriver/no-inputs.test b/test/LibDriver/no-inputs.test new file mode 100644 index 00000000000..95d6555d58c --- /dev/null +++ b/test/LibDriver/no-inputs.test @@ -0,0 +1,2 @@ +RUN: llvm-lib -out:%t.a +RUN: test ! -e %t.a