[llvm] [dsymutil] Remove paper trail warnings (PR #67041)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 10:03:59 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

<details>
<summary>Changes</summary>

Remove the paper trail warning from dsymutil and the DWARF linker. The original purpose of this functionality was to leave a paper trail in the output artifact about missing object files. The current implementation however has diverged and is the source of a pretty serious bug:

  - In the debug map parser, missing object files are not the only warnings we emit. When paper trail warnings are enabled, all of them end up in the dSYM which wasn't the goal.
  - When warnings are associated with a object file in the debug map, it is skipped by the DWARF linker. This only makes sense if the object file is missing and is obviously incorrect for any other type of warning (such as a missing symbol).

The combination of the two means that we can generate broken DWARF when the feature is enabled. AFAIK it was only used by Apple and nobody I spoke to has relied on it, so rather than fixing the broken behavior I propose we remove it.

---

Patch is 20.10 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/67041.diff


13 Files Affected:

- (modified) llvm/docs/CommandGuide/dsymutil.rst (-7) 
- (modified) llvm/include/llvm/DWARFLinker/DWARFLinker.h (-7) 
- (modified) llvm/include/llvm/DWARFLinker/DWARFStreamer.h (-3) 
- (modified) llvm/lib/DWARFLinker/DWARFLinker.cpp (-66) 
- (modified) llvm/lib/DWARFLinker/DWARFStreamer.cpp (-12) 
- (modified) llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp (+1-109) 
- (modified) llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.h (-3) 
- (removed) llvm/test/tools/dsymutil/X86/papertrail-warnings.test (-32) 
- (modified) llvm/test/tools/dsymutil/cmdline.test (-1) 
- (modified) llvm/tools/dsymutil/MachODebugMapParser.cpp (+4-16) 
- (modified) llvm/tools/dsymutil/Options.td (-4) 
- (modified) llvm/tools/dsymutil/dsymutil.cpp (+2-12) 
- (modified) llvm/tools/dsymutil/dsymutil.h (+1-2) 


``````````diff
diff --git a/llvm/docs/CommandGuide/dsymutil.rst b/llvm/docs/CommandGuide/dsymutil.rst
index 0cc2a472bbd0696..02243e227a24d4a 100644
--- a/llvm/docs/CommandGuide/dsymutil.rst
+++ b/llvm/docs/CommandGuide/dsymutil.rst
@@ -100,13 +100,6 @@ OPTIONS
  Specifies an alternate ``path`` to place the dSYM bundle. The default dSYM
  bundle path is created by appending ``.dSYM`` to the executable name.
 
-.. option:: --papertrail
-
- When running dsymutil as part of your build system, it can be desirable for
- warnings to be part of the end product, rather than just being emitted to the
- output stream. When enabled warnings are embedded in the linked DWARF debug
- information.
-
 .. option:: --remarks-drop-without-debug
 
  Drop remarks without valid debug locations. Without this flags, all remarks are kept.
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 5ca6f2e4e4e06e0..7105ab778e4dafc 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -99,9 +99,6 @@ class DwarfEmitter {
 public:
   virtual ~DwarfEmitter();
 
-  /// Emit DIE containing warnings.
-  virtual void emitPaperTrailWarningsDie(DIE &Die) = 0;
-
   /// Emit section named SecName with data SecData.
   virtual void emitSectionContents(StringRef SecData, StringRef SecName) = 0;
 
@@ -508,10 +505,6 @@ class DWARFLinker {
       ErrorHandler(Warning, File.FileName, DIE);
   }
 
-  /// Emit warnings as Dwarf compile units to leave a trail after linking.
-  bool emitPaperTrailWarnings(const DWARFFile &File,
-                              OffsetsStringPool &StringPool);
-
   void copyInvariantDebugSection(DWARFContext &Dwarf);
 
   /// Keep information for referenced clang module: already loaded DWARF info
diff --git a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
index b95abfbefa1065b..63e4b28a8d2c997 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
@@ -72,9 +72,6 @@ class DwarfStreamer : public DwarfEmitter {
   void emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
                    unsigned DwarfVersion) override;
 
-  /// Emit DIE containing warnings.
-  void emitPaperTrailWarningsDie(DIE &Die) override;
-
   /// Emit contents of section SecName From Obj.
   void emitSectionContents(StringRef SecData, StringRef SecName) override;
 
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 35e5cefc3877060..5ed4923dc0125a6 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -2584,69 +2584,6 @@ uint64_t DWARFLinker::DIECloner::cloneAllCompileUnits(
   return OutputDebugInfoSize - StartOutputDebugInfoSize;
 }
 
-bool DWARFLinker::emitPaperTrailWarnings(const DWARFFile &File,
-                                         OffsetsStringPool &StringPool) {
-
-  if (File.Warnings.empty())
-    return false;
-
-  DIE *CUDie = DIE::get(DIEAlloc, dwarf::DW_TAG_compile_unit);
-  CUDie->setOffset(11);
-  StringRef Producer;
-  StringRef WarningHeader;
-
-  switch (DwarfLinkerClientID) {
-  case DwarfLinkerClient::Dsymutil:
-    Producer = StringPool.internString("dsymutil");
-    WarningHeader = "dsymutil_warning";
-    break;
-
-  default:
-    Producer = StringPool.internString("dwarfopt");
-    WarningHeader = "dwarfopt_warning";
-    break;
-  }
-
-  StringRef FileName = StringPool.internString(File.FileName);
-  CUDie->addValue(DIEAlloc, dwarf::DW_AT_producer, dwarf::DW_FORM_strp,
-                  DIEInteger(StringPool.getStringOffset(Producer)));
-  DIEBlock *String = new (DIEAlloc) DIEBlock();
-  DIEBlocks.push_back(String);
-  for (auto &C : FileName)
-    String->addValue(DIEAlloc, dwarf::Attribute(0), dwarf::DW_FORM_data1,
-                     DIEInteger(C));
-  String->addValue(DIEAlloc, dwarf::Attribute(0), dwarf::DW_FORM_data1,
-                   DIEInteger(0));
-
-  CUDie->addValue(DIEAlloc, dwarf::DW_AT_name, dwarf::DW_FORM_string, String);
-  for (const auto &Warning : File.Warnings) {
-    DIE &ConstDie = CUDie->addChild(DIE::get(DIEAlloc, dwarf::DW_TAG_constant));
-    ConstDie.addValue(DIEAlloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp,
-                      DIEInteger(StringPool.getStringOffset(WarningHeader)));
-    ConstDie.addValue(DIEAlloc, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag,
-                      DIEInteger(1));
-    ConstDie.addValue(DIEAlloc, dwarf::DW_AT_const_value, dwarf::DW_FORM_strp,
-                      DIEInteger(StringPool.getStringOffset(Warning)));
-  }
-  unsigned Size = 4 /* FORM_strp */ + FileName.size() + 1 +
-                  File.Warnings.size() * (4 + 1 + 4) + 1 /* End of children */;
-  DIEAbbrev Abbrev = CUDie->generateAbbrev();
-  assignAbbrev(Abbrev);
-  CUDie->setAbbrevNumber(Abbrev.getNumber());
-  Size += getULEB128Size(Abbrev.getNumber());
-  // Abbreviation ordering needed for classic compatibility.
-  for (auto &Child : CUDie->children()) {
-    Abbrev = Child.generateAbbrev();
-    assignAbbrev(Abbrev);
-    Child.setAbbrevNumber(Abbrev.getNumber());
-    Size += getULEB128Size(Abbrev.getNumber());
-  }
-  CUDie->setSize(Size);
-  TheDwarfEmitter->emitPaperTrailWarningsDie(*CUDie);
-
-  return true;
-}
-
 void DWARFLinker::copyInvariantDebugSection(DWARFContext &Dwarf) {
   TheDwarfEmitter->emitSectionContents(Dwarf.getDWARFObj().getLocSection().Data,
                                        "debug_loc");
@@ -2711,9 +2648,6 @@ Error DWARFLinker::link() {
         outs() << "OBJECT FILE: " << OptContext.File.FileName << "\n";
     }
 
-    if (emitPaperTrailWarnings(OptContext.File, DebugStrPool))
-      continue;
-
     if (!OptContext.File.Dwarf)
       continue;
 
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index 4d5eef54408edb8..3bcc5a065a04718 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -234,18 +234,6 @@ void DwarfStreamer::emitSectionContents(StringRef SecData, StringRef SecName) {
   }
 }
 
-/// Emit DIE containing warnings.
-void DwarfStreamer::emitPaperTrailWarningsDie(DIE &Die) {
-  switchToDebugInfoSection(/* Version */ 2);
-  auto &Asm = getAsmPrinter();
-  Asm.emitInt32(11 + Die.getSize() - 4);
-  Asm.emitInt16(2);
-  Asm.emitInt32(0);
-  Asm.emitInt8(MC->getTargetTriple().isArch64Bit() ? 8 : 4);
-  DebugInfoSectionSize += 11;
-  emitDIE(Die);
-}
-
 /// Emit the debug_str section stored in \p Pool.
 void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
   Asm->OutStreamer->switchSection(MOFI->getDwarfStrSection());
diff --git a/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp b/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp
index 799910a6ed9fba7..97acd3dcf0b1da7 100644
--- a/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp
+++ b/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp
@@ -462,19 +462,7 @@ Error DWARFLinkerImpl::LinkContext::link() {
     }
   }
 
-  if (!InputDWARFFile.Warnings.empty()) {
-    // Create compile unit with paper trail warnings.
-
-    Error ResultErr = Error::success();
-    // We use task group here as PerThreadBumpPtrAllocator should be called from
-    // the threads created by ThreadPoolExecutor.
-    parallel::TaskGroup TGroup;
-    TGroup.spawn([&]() {
-      if (Error Err = cloneAndEmitPaperTrails())
-        ResultErr = std::move(Err);
-    });
-    return ResultErr;
-  } else if (GlobalData.getOptions().UpdateIndexTablesOnly) {
+  if (GlobalData.getOptions().UpdateIndexTablesOnly) {
     // Emit Invariant sections.
 
     if (Error Err = emitInvariantSections())
@@ -715,102 +703,6 @@ void DWARFLinkerImpl::LinkContext::emitFDE(uint32_t CIEOffset,
   Section.OS.write(FDEBytes.data(), FDEBytes.size());
 }
 
-Error DWARFLinkerImpl::LinkContext::cloneAndEmitPaperTrails() {
-  CompileUnits.emplace_back(std::make_unique<CompileUnit>(
-      GlobalData, UniqueUnitID.fetch_add(1), "", InputDWARFFile,
-      getUnitForOffset, Format, Endianness));
-
-  CompileUnit &CU = *CompileUnits.back();
-
-  BumpPtrAllocator Allocator;
-
-  DIEGenerator ParentGenerator(Allocator, CU);
-
-  SectionDescriptor &DebugInfoSection =
-      CU.getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo);
-  OffsetsPtrVector PatchesOffsets;
-
-  uint64_t CurrentOffset = CU.getDebugInfoHeaderSize();
-  DIE *CUDie =
-      ParentGenerator.createDIE(dwarf::DW_TAG_compile_unit, CurrentOffset);
-  CU.setOutUnitDIE(CUDie);
-
-  DebugInfoSection.notePatchWithOffsetUpdate(
-      DebugStrPatch{{CurrentOffset},
-                    GlobalData.getStringPool().insert("dsymutil").first},
-      PatchesOffsets);
-  CurrentOffset += ParentGenerator
-                       .addStringPlaceholderAttribute(dwarf::DW_AT_producer,
-                                                      dwarf::DW_FORM_strp)
-                       .second;
-
-  CurrentOffset +=
-      ParentGenerator
-          .addInplaceString(dwarf::DW_AT_name, InputDWARFFile.FileName)
-          .second;
-
-  size_t SizeAbbrevNumber = ParentGenerator.finalizeAbbreviations(true);
-  CurrentOffset += SizeAbbrevNumber;
-  for (uint64_t *OffsetPtr : PatchesOffsets)
-    *OffsetPtr += SizeAbbrevNumber;
-  for (const auto &Warning : CU.getContaingFile().Warnings) {
-    PatchesOffsets.clear();
-    DIEGenerator ChildGenerator(Allocator, CU);
-
-    DIE *ChildDie =
-        ChildGenerator.createDIE(dwarf::DW_TAG_constant, CurrentOffset);
-    ParentGenerator.addChild(ChildDie);
-
-    DebugInfoSection.notePatchWithOffsetUpdate(
-        DebugStrPatch{
-            {CurrentOffset},
-            GlobalData.getStringPool().insert("dsymutil_warning").first},
-        PatchesOffsets);
-    CurrentOffset += ChildGenerator
-                         .addStringPlaceholderAttribute(dwarf::DW_AT_name,
-                                                        dwarf::DW_FORM_strp)
-                         .second;
-
-    CurrentOffset +=
-        ChildGenerator
-            .addScalarAttribute(dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1)
-            .second;
-
-    DebugInfoSection.notePatchWithOffsetUpdate(
-        DebugStrPatch{{CurrentOffset},
-                      GlobalData.getStringPool().insert(Warning).first},
-        PatchesOffsets);
-    CurrentOffset += ChildGenerator
-                         .addStringPlaceholderAttribute(
-                             dwarf::DW_AT_const_value, dwarf::DW_FORM_strp)
-                         .second;
-
-    SizeAbbrevNumber = ChildGenerator.finalizeAbbreviations(false);
-
-    CurrentOffset += SizeAbbrevNumber;
-    for (uint64_t *OffsetPtr : PatchesOffsets)
-      *OffsetPtr += SizeAbbrevNumber;
-
-    ChildDie->setSize(CurrentOffset - ChildDie->getOffset());
-  }
-
-  CurrentOffset += 1; // End of children
-  CUDie->setSize(CurrentOffset - CUDie->getOffset());
-
-  uint64_t UnitSize = 0;
-  UnitSize += CU.getDebugInfoHeaderSize();
-  UnitSize += CUDie->getSize();
-  CU.setUnitSize(UnitSize);
-
-  if (GlobalData.getOptions().NoOutput)
-    return Error::success();
-
-  if (Error Err = CU.emitDebugInfo(*TargetTriple))
-    return Err;
-
-  return CU.emitAbbreviations();
-}
-
 void DWARFLinkerImpl::glueCompileUnitsAndWriteToTheOutput() {
   if (GlobalData.getOptions().NoOutput)
     return;
diff --git a/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.h b/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.h
index c04eb8467e4a89d..bee212ba95ec3bc 100644
--- a/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.h
+++ b/llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.h
@@ -294,9 +294,6 @@ class DWARFLinkerImpl : public DWARFLinker {
     void emitFDE(uint32_t CIEOffset, uint32_t AddrSize, uint64_t Address,
                  StringRef FDEBytes, SectionDescriptor &Section);
 
-    /// Clone and emit paper trails.
-    Error cloneAndEmitPaperTrails();
-
     std::function<CompileUnit *(uint64_t)> getUnitForOffset =
         [&](uint64_t Offset) -> CompileUnit * {
       auto CU = llvm::upper_bound(
diff --git a/llvm/test/tools/dsymutil/X86/papertrail-warnings.test b/llvm/test/tools/dsymutil/X86/papertrail-warnings.test
deleted file mode 100644
index 69c851a335ad692..000000000000000
--- a/llvm/test/tools/dsymutil/X86/papertrail-warnings.test
+++ /dev/null
@@ -1,32 +0,0 @@
-RUN: env RC_DEBUG_OPTIONS=1 dsymutil -f %p/../Inputs/basic.macho.x86_64 -o - | llvm-dwarfdump -v - | FileCheck -DMSG=%errc_ENOENT %s
-
-RUN: env RC_DEBUG_OPTIONS=1 dsymutil --linker llvm -f %p/../Inputs/basic.macho.x86_64 -o - | llvm-dwarfdump -v - | FileCheck -DMSG=%errc_ENOENT %s
-
-CHECK: .debug_info contents:
-CHECK:  Compile Unit:
-CHECK:  DW_TAG_compile_unit [1] *
-CHECK:    DW_AT_producer {{.*}}"dsymutil
-CHECK:    DW_AT_name {{.*}}"/Inputs/basic1.macho.x86_64.o"
-CHECK:    DW_TAG_constant [2]
-CHECK:      DW_AT_name {{.*}}"dsymutil_warning"
-CHECK:      DW_AT_artificial [DW_FORM_flag]	(0x01)
-CHECK:      DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
-CHECK:    NULL
-CHECK:  Compile Unit:
-CHECK:  DW_TAG_compile_unit [1] *
-CHECK:    DW_AT_producer {{.*}}"dsymutil
-CHECK:    DW_AT_name {{.*}}"/Inputs/basic2.macho.x86_64.o"
-CHECK:    DW_TAG_constant [2]
-CHECK:      DW_AT_name {{.*}}"dsymutil_warning"
-CHECK:      DW_AT_artificial [DW_FORM_flag]	(0x01)
-CHECK:      DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
-CHECK:    NULL
-CHECK:  Compile Unit:
-CHECK:  DW_TAG_compile_unit [1] *
-CHECK:    DW_AT_producer {{.*}}"dsymutil
-CHECK:    DW_AT_name {{.*}}"/Inputs/basic3.macho.x86_64.o"
-CHECK:    DW_TAG_constant [2]
-CHECK:      DW_AT_name {{.*}}"dsymutil_warning"
-CHECK:      DW_AT_artificial [DW_FORM_flag]	(0x01)
-CHECK:      DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
-CHECK:    NULL
diff --git a/llvm/test/tools/dsymutil/cmdline.test b/llvm/test/tools/dsymutil/cmdline.test
index dc716cf25b21fc2..2317852f3c489e2 100644
--- a/llvm/test/tools/dsymutil/cmdline.test
+++ b/llvm/test/tools/dsymutil/cmdline.test
@@ -21,7 +21,6 @@ CHECK: -object-prefix-map <prefix=remapped>
 CHECK: -oso-prepend-path <path>
 CHECK: -out <filename>
 CHECK: {{-o <filename>}}
-CHECK: -papertrail
 CHECK: -remarks-drop-without-debug
 CHECK: -remarks-output-format <format>
 CHECK: -remarks-prepend-path <path>
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index d3bda338a9b3230..d9bf2301e21e55f 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -28,11 +28,9 @@ class MachODebugMapParser {
 public:
   MachODebugMapParser(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
                       StringRef BinaryPath, ArrayRef<std::string> Archs,
-                      StringRef PathPrefix = "",
-                      bool PaperTrailWarnings = false, bool Verbose = false)
+                      StringRef PathPrefix = "", bool Verbose = false)
       : BinaryPath(std::string(BinaryPath)), Archs(Archs.begin(), Archs.end()),
-        PathPrefix(std::string(PathPrefix)),
-        PaperTrailWarnings(PaperTrailWarnings), BinHolder(VFS, Verbose),
+        PathPrefix(std::string(PathPrefix)), BinHolder(VFS, Verbose),
         CurrentDebugMapObject(nullptr), SkipDebugMapObject(false) {}
 
   /// Parses and returns the DebugMaps of the input binary. The binary contains
@@ -50,7 +48,6 @@ class MachODebugMapParser {
   std::string BinaryPath;
   SmallVector<StringRef, 1> Archs;
   std::string PathPrefix;
-  bool PaperTrailWarnings;
 
   /// Owns the MemoryBuffer for the main binary.
   BinaryHolder BinHolder;
@@ -137,13 +134,6 @@ class MachODebugMapParser {
                          << MachOUtils::getArchName(
                                 Result->getTriple().getArchName())
                          << ") " << File << " " << Msg << "\n";
-
-    if (PaperTrailWarnings) {
-      if (!File.empty())
-        Result->addDebugMapObject(File, sys::TimePoint<std::chrono::seconds>());
-      if (Result->end() != Result->begin())
-        (*--Result->end())->addWarning(Msg.str());
-    }
   }
 };
 
@@ -704,13 +694,11 @@ namespace dsymutil {
 llvm::ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
 parseDebugMap(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
               StringRef InputFile, ArrayRef<std::string> Archs,
-              StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,
-              bool InputIsYAML) {
+              StringRef PrependPath, bool Verbose, bool InputIsYAML) {
   if (InputIsYAML)
     return DebugMap::parseYAMLDebugMap(InputFile, PrependPath, Verbose);
 
-  MachODebugMapParser Parser(VFS, InputFile, Archs, PrependPath,
-                             PaperTrailWarnings, Verbose);
+  MachODebugMapParser Parser(VFS, InputFile, Archs, PrependPath, Verbose);
   return Parser.parse();
 }
 
diff --git a/llvm/tools/dsymutil/Options.td b/llvm/tools/dsymutil/Options.td
index 9b0b31b4b0e1d87..79f04fdfb036055 100644
--- a/llvm/tools/dsymutil/Options.td
+++ b/llvm/tools/dsymutil/Options.td
@@ -69,10 +69,6 @@ def yaml_input: Flag<["-", "--"], "y">,
   HelpText<"Treat the input file is a YAML debug map rather than a binary.">,
   Group<grp_general>;
 
-def papertrail: F<"papertrail">,
-  HelpText<"Embed warnings in the linked DWARF debug info.">,
-  Group<grp_general>;
-
 def assembly: Flag<["-", "--"], "S">,
   HelpText<"Output textual assembly instead of a binary dSYM companion file.">,
   Group<grp_general>;
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index 49a3541e9ae78f1..104895b1a90bdaa 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -107,7 +107,6 @@ struct DsymutilOptions {
   bool DumpStab = false;
   bool Flat = false;
   bool InputIsYAMLDebugMap = false;
-  bool PaperTrailWarnings = false;
   bool ForceKeepFunctionForStatic = false;
   std::string SymbolMap;
   std::string OutputFile;
@@ -198,11 +197,6 @@ static Error verifyOptions(const DsymutilOptions &Options) {
         "cannot use -o with multiple inputs in flat mode.",
         errc::invalid_argument);
 
-  if (Options.PaperTrailWarnings && Options.InputIsYAMLDebugMap)
-    return make_error<StringError>(
-        "paper trail warnings are not supported for YAML input.",
-        errc::invalid_argument);
-
   if (!Options.ReproducerPath.empty() &&
       Options.ReproMode != ReproducerMode::Use)
     return make_error<StringError>(
@@ -304,7 +298,6 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
   Options.DumpStab = Args.hasArg(OPT_symtab);
   Options.Flat = Args.hasArg(OPT_flat);
   Options.InputIsYAMLDebugMap = Args.hasArg(OPT_yaml_input);
-  Options.PaperTrailWarnings = Args.hasArg(OPT_papertrail);
 
   if (Expected<DWARFVerify> Verify = getVerifyKind(Args)) {
     Options.Verify = *Verify;
@@ -390,9 +383,6 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
   if (Options.DumpDebugMap || Options.LinkOpts.Verbose)
     Options.LinkOpts.Threads = 1;
 
-  if (getenv("RC_DEBUG_OPTIONS"))
-    Options.PaperTrailWarnings = true;
-
   if (opt::Arg *RemarksPrependPath = Args.getLastArg(OPT_remarks_prepend_path))
     Options.LinkOpts.RemarksPrependPath = RemarksPrependPath->getValue();
 
@@ -687,8 +677,8 @@ int dsymutil_main(int argc, char **argv, const llvm::ToolContext &) {
 
     auto DebugMapPtrsOrErr =
         parseDebugMap(Options.LinkOpts.VFS, InputFile, Options.Archs,
-                      Options.LinkOpts.PrependPath, Options.PaperTrailWarnings,
-                      Options.LinkOpts.Verbose, Options.InputIsYAMLDebugMap);
+                      Options.LinkOpts.PrependPath, Options.LinkOpts.Verbose,
+                      Options.InputIsYAMLDebugMap);
 
     if (auto EC = DebugMapPtrsOrErr.getError()) {
       WithColor::error() << "cannot parse the debug map for '" << InputFile
diff --git a/llvm/tools/dsymutil/dsymutil.h b/llvm/tools/dsymutil/dsymutil.h
index 60f8e3a07ff70f9..ddecd8a76c7fc96 100644
--- a/llvm/tools/dsymutil/dsymutil.h
+++ b/llvm/tools/dsymutil/dsymutil.h
@@ -35,8 +35,7 @@ namespace dsymutil {
 ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
 parseDebugMap(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
               StringRef InputFile, ArrayRef<std::string> Archs,
-              StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,
-              bool InputIsYAML);
+              StringRef PrependPath, bool Verbose, bool InputIsY...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/67041


More information about the llvm-commits mailing list