[llvm] 9f8678b - [DWARFLinker] Honor verbose flag for input verification

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 22:00:54 PDT 2023


Author: Jonas Devlieghere
Date: 2023-03-29T22:00:47-07:00
New Revision: 9f8678b38cd52b2e6a23cfbbd73d6cdd3b2d4c03

URL: https://github.com/llvm/llvm-project/commit/9f8678b38cd52b2e6a23cfbbd73d6cdd3b2d4c03
DIFF: https://github.com/llvm/llvm-project/commit/9f8678b38cd52b2e6a23cfbbd73d6cdd3b2d4c03.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/DWARFLinker/DWARFLinker.cpp
    llvm/test/tools/dsymutil/X86/verify.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 789a7789c807a..1a61506b04a03 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -2891,8 +2891,9 @@ Error DWARFLinker::cloneModuleUnit(LinkContext &Context, RefModuleUnit &Unit,
 bool DWARFLinker::verify(const DWARFFile &File) {
   assert(File.Dwarf);
 
+  raw_ostream &os = Options.Verbose ? errs() : nulls();
   DIDumpOptions DumpOpts;
-  if (!File.Dwarf->verify(llvm::outs(), DumpOpts.noImplicitRecursion())) {
+  if (!File.Dwarf->verify(os, DumpOpts.noImplicitRecursion())) {
     reportWarning("input verification failed", File);
     return false;
   }

diff  --git a/llvm/test/tools/dsymutil/X86/verify.test b/llvm/test/tools/dsymutil/X86/verify.test
index eb8aa045c0f7b..2a7b1938e843f 100644
--- a/llvm/test/tools/dsymutil/X86/verify.test
+++ b/llvm/test/tools/dsymutil/X86/verify.test
@@ -16,7 +16,8 @@
 # RUN: dsymutil -verify-dwarf=input -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefix=QUIET-INPUT-FAIL
 # RUN: dsymutil -verify-dwarf=none -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=QUIET-SUCCESS
 # RUN: not dsymutil -verify-dwarf=bogus -verbose -oso-prepend-path=%p/../Inputs -y %s -o %t 2>&1 | FileCheck %s --check-prefixes=BOGUS
-# 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
+# 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
+# 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
 
 # VERBOSE-INPUT-FAIL-DAG: error: Abbreviation declaration contains multiple DW_AT_language attributes.
 # QUIET-INPUT-FAIL-DAG: warning: input verification failed


        


More information about the llvm-commits mailing list