mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-01 07:11:45 +00:00
[dsymutil] Print warning/error for unknown/missing arguments.
After changing dsymutil to use libOption, we lost error reporting for missing required arguments (input files). Additionally, we stopped complaining about unknown arguments. This patch fixes both and adds a test. llvm-svn: 375044
This commit is contained in:
parent
ebf24ce8e1
commit
490dcffb69
@ -26,3 +26,9 @@ HELP-NOT: -reverse-iterate
|
||||
|
||||
RUN: dsymutil --version 2>&1 | FileCheck --check-prefix=VERSION %s
|
||||
VERSION: {{ version }}
|
||||
|
||||
RUN: not dsymutil 2>&1 | FileCheck --check-prefix=NOINPUT %s
|
||||
NOINPUT: error: no input files specified
|
||||
|
||||
RUN: dsymutil -bogus -help 2>&1 | FileCheck --check-prefix=BOGUS %s
|
||||
BOGUS: warning: ignoring unknown option: -bogus
|
||||
|
@ -148,6 +148,11 @@ static Expected<std::vector<std::string>> getInputs(opt::InputArgList &Args,
|
||||
|
||||
// Verify that the given combination of options makes sense.
|
||||
static Error verifyOptions(const DsymutilOptions &Options) {
|
||||
if (Options.InputFiles.empty()) {
|
||||
return make_error<StringError>("no input files specified",
|
||||
errc::invalid_argument);
|
||||
}
|
||||
|
||||
if (Options.LinkOpts.Update &&
|
||||
std::find(Options.InputFiles.begin(), Options.InputFiles.end(), "-") !=
|
||||
Options.InputFiles.end()) {
|
||||
@ -440,6 +445,11 @@ int main(int argc, char **argv) {
|
||||
std::string SDKPath = sys::fs::getMainExecutable(argv[0], P);
|
||||
SDKPath = sys::path::parent_path(SDKPath);
|
||||
|
||||
for (auto *Arg : Args.filtered(OPT_UNKNOWN)) {
|
||||
WithColor::warning() << "ignoring unknown option: " << Arg->getSpelling()
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_help)) {
|
||||
T.PrintHelp(
|
||||
outs(), (std::string(argv[0]) + " [options] <input files>").c_str(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user