@@ -169,6 +169,12 @@ static Expected<std::vector<std::string>> getInputs(opt::InputArgList &Args,
169
169
170
170
// Verify that the given combination of options makes sense.
171
171
static Error verifyOptions (const DsymutilOptions &Options) {
172
+ if (Options.LinkOpts .Verbose && Options.LinkOpts .Quiet ) {
173
+ return make_error<StringError>(
174
+ " --quiet and --verbose cannot be specified together" ,
175
+ errc::invalid_argument);
176
+ }
177
+
172
178
if (Options.InputFiles .empty ()) {
173
179
return make_error<StringError>(" no input files specified" ,
174
180
errc::invalid_argument);
@@ -311,6 +317,7 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
311
317
Options.LinkOpts .NoTimestamp = Args.hasArg (OPT_no_swiftmodule_timestamp);
312
318
Options.LinkOpts .Update = Args.hasArg (OPT_update);
313
319
Options.LinkOpts .Verbose = Args.hasArg (OPT_verbose);
320
+ Options.LinkOpts .Quiet = Args.hasArg (OPT_quiet);
314
321
Options.LinkOpts .Statistics = Args.hasArg (OPT_statistics);
315
322
Options.LinkOpts .Fat64 = Args.hasArg (OPT_fat64);
316
323
Options.LinkOpts .KeepFunctionForStatic =
@@ -483,16 +490,20 @@ static bool verifyOutput(StringRef OutputFile, StringRef Arch,
483
490
DsymutilOptions Options, std::mutex &Mutex) {
484
491
485
492
if (OutputFile == " -" ) {
486
- std::lock_guard<std::mutex> Guard (Mutex);
487
- WithColor::warning () << " verification skipped for " << Arch
488
- << " because writing to stdout.\n " ;
493
+ if (!Options.LinkOpts .Quiet ) {
494
+ std::lock_guard<std::mutex> Guard (Mutex);
495
+ WithColor::warning () << " verification skipped for " << Arch
496
+ << " because writing to stdout.\n " ;
497
+ }
489
498
return true ;
490
499
}
491
500
492
501
if (Options.LinkOpts .NoOutput ) {
493
- std::lock_guard<std::mutex> Guard (Mutex);
494
- WithColor::warning () << " verification skipped for " << Arch
495
- << " because --no-output was passed.\n " ;
502
+ if (!Options.LinkOpts .Quiet ) {
503
+ std::lock_guard<std::mutex> Guard (Mutex);
504
+ WithColor::warning () << " verification skipped for " << Arch
505
+ << " because --no-output was passed.\n " ;
506
+ }
496
507
return true ;
497
508
}
498
509
@@ -507,10 +518,12 @@ static bool verifyOutput(StringRef OutputFile, StringRef Arch,
507
518
if (auto *Obj = dyn_cast<MachOObjectFile>(&Binary)) {
508
519
std::unique_ptr<DWARFContext> DICtx = DWARFContext::create (*Obj);
509
520
if (DICtx->getMaxVersion () > 5 ) {
510
- std::lock_guard<std::mutex> Guard (Mutex);
511
- WithColor::warning ()
512
- << " verification skipped for " << Arch
513
- << " because DWARF standard greater than v5 is not supported yet.\n " ;
521
+ if (!Options.LinkOpts .Quiet ) {
522
+ std::lock_guard<std::mutex> Guard (Mutex);
523
+ WithColor::warning () << " verification skipped for " << Arch
524
+ << " because DWARF standard greater than v5 is "
525
+ " not supported yet.\n " ;
526
+ }
514
527
return true ;
515
528
}
516
529
@@ -751,11 +764,13 @@ int dsymutil_main(int argc, char **argv, const llvm::ToolContext &) {
751
764
continue ;
752
765
753
766
if (Map->begin () == Map->end ()) {
754
- std::lock_guard<std::mutex> Guard (ErrorHandlerMutex);
755
- WithColor::warning ()
756
- << " no debug symbols in executable (-arch "
757
- << MachOUtils::getArchName (Map->getTriple ().getArchName ())
758
- << " )\n " ;
767
+ if (!Options.LinkOpts .Quiet ) {
768
+ std::lock_guard<std::mutex> Guard (ErrorHandlerMutex);
769
+ WithColor::warning ()
770
+ << " no debug symbols in executable (-arch "
771
+ << MachOUtils::getArchName (Map->getTriple ().getArchName ())
772
+ << " )\n " ;
773
+ }
759
774
}
760
775
761
776
// Using a std::shared_ptr rather than std::unique_ptr because move-only
0 commit comments