Skip to content

Commit f38eb5f

Browse files
author
git apple-llvm automerger
committed
Merge commit '04acb6038a0b' from apple/stable/20190619 into swift/master
2 parents 1c2b760 + 04acb60 commit f38eb5f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/test/tools/dsymutil/cmdline.test

+6
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ HELP-NOT: -reverse-iterate
2626

2727
RUN: dsymutil --version 2>&1 | FileCheck --check-prefix=VERSION %s
2828
VERSION: {{ version }}
29+
30+
RUN: not dsymutil 2>&1 | FileCheck --check-prefix=NOINPUT %s
31+
NOINPUT: error: no input files specified
32+
33+
RUN: dsymutil -bogus -help 2>&1 | FileCheck --check-prefix=BOGUS %s
34+
BOGUS: warning: ignoring unknown option: -bogus

llvm/tools/dsymutil/dsymutil.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ static Expected<std::vector<std::string>> getInputs(opt::InputArgList &Args,
148148

149149
// Verify that the given combination of options makes sense.
150150
static Error verifyOptions(const DsymutilOptions &Options) {
151+
if (Options.InputFiles.empty()) {
152+
return make_error<StringError>("no input files specified",
153+
errc::invalid_argument);
154+
}
155+
151156
if (Options.LinkOpts.Update &&
152157
std::find(Options.InputFiles.begin(), Options.InputFiles.end(), "-") !=
153158
Options.InputFiles.end()) {
@@ -440,6 +445,11 @@ int main(int argc, char **argv) {
440445
std::string SDKPath = sys::fs::getMainExecutable(argv[0], P);
441446
SDKPath = sys::path::parent_path(SDKPath);
442447

448+
for (auto *Arg : Args.filtered(OPT_UNKNOWN)) {
449+
WithColor::warning() << "ignoring unknown option: " << Arg->getSpelling()
450+
<< '\n';
451+
}
452+
443453
if (Args.hasArg(OPT_help)) {
444454
T.PrintHelp(
445455
outs(), (std::string(argv[0]) + " [options] <input files>").c_str(),

0 commit comments

Comments
 (0)