Skip to content

Commit 894d63a

Browse files
committed
[DWARFLinker] Honor verbose flag for input verification
Fix an inconsistency between input and output verification in dsymutil. Previously, output verification would be controlled by the verbose flag, while input verification would unconditionally dump to stdout. Make input and output verification behave the same by printing verification error to stderr in verbose mode only. (cherry picked from commit 9f8678b)
1 parent 67e69d5 commit 894d63a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

llvm/lib/DWARFLinker/DWARFLinker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2837,8 +2837,9 @@ Error DWARFLinker::cloneModuleUnit(LinkContext &Context, RefModuleUnit &Unit,
28372837
bool DWARFLinker::verify(const DWARFFile &File) {
28382838
assert(File.Dwarf);
28392839

2840+
raw_ostream &os = Options.Verbose ? errs() : nulls();
28402841
DIDumpOptions DumpOpts;
2841-
if (!File.Dwarf->verify(llvm::outs(), DumpOpts.noImplicitRecursion())) {
2842+
if (!File.Dwarf->verify(os, DumpOpts.noImplicitRecursion())) {
28422843
reportWarning("input verification failed", File);
28432844
return false;
28442845
}

llvm/test/tools/dsymutil/X86/verify.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
# RUN: dsymutil -verify-dwarf=input -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefix=QUIET-INPUT-FAIL
1717
# RUN: dsymutil -verify-dwarf=none -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=QUIET-SUCCESS
1818
# RUN: not dsymutil -verify-dwarf=bogus -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=BOGUS
19-
# RUN: not dsymutil -verify-dwarf=all -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=QUIET-OUTPUT-FAIL,QUIET-INPUT-FAIL,VERBOSE-INPUT-FAIL
19+
# RUN: not dsymutil -verify-dwarf=all -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=QUIET-OUTPUT-FAIL,QUIET-INPUT-FAIL
20+
# RUN: not dsymutil -verify-dwarf=all -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=VERBOSE-INPUT-FAIL
2021

2122
# VERBOSE-INPUT-FAIL-DAG: error: Abbreviation declaration contains multiple DW_AT_language attributes.
2223
# QUIET-INPUT-FAIL-DAG: warning: input verification failed

0 commit comments

Comments
 (0)