Skip to content

[dsymutil] Remove paper trail warnings #7517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions llvm/test/tools/dsymutil/X86/papertrail-warnings.test

This file was deleted.

20 changes: 4 additions & 16 deletions llvm/tools/dsymutil/MachODebugMapParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,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
Expand All @@ -49,7 +47,6 @@ class MachODebugMapParser {
std::string BinaryPath;
SmallVector<StringRef, 1> Archs;
std::string PathPrefix;
bool PaperTrailWarnings;

/// Owns the MemoryBuffer for the main binary.
BinaryHolder BinHolder;
Expand Down Expand Up @@ -136,13 +133,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());
}
}
};

Expand Down Expand Up @@ -702,13 +692,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();
}

Expand Down
14 changes: 2 additions & 12 deletions llvm/tools/dsymutil/dsymutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ struct DsymutilOptions {
bool DumpStab = false;
bool Flat = false;
bool InputIsYAMLDebugMap = false;
bool PaperTrailWarnings = false;
bool ForceKeepFunctionForStatic = false;
std::string SymbolMap;
std::string OutputFile;
Expand Down Expand Up @@ -191,11 +190,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>(
Expand Down Expand Up @@ -279,7 +273,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;
Expand Down Expand Up @@ -358,9 +351,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();

Expand Down Expand Up @@ -623,8 +613,8 @@ int dsymutil_main(int argc, char **argv) {

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
Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/dsymutil/dsymutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class BinaryHolder;
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);

/// Dump the symbol table.
bool dumpStab(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
Expand Down