This is an archive of the discontinued LLVM Phabricator instance.

[llvm-pdbutil] Move global state (Filters) inside LinePrinter class.
ClosedPublic

Authored by CarlosAlbertoEnciso on Apr 1 2022, 2:31 AM.

Details

Summary

The changes described by:

https://reviews.llvm.org/D121801
https://reviews.llvm.org/D122226

Moved some llvm-pdbutil functionality to the debug PDB library.

This patch addresses one outstanding issue concerning the global
state (Filters) created in the PDB library.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 2:31 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
CarlosAlbertoEnciso requested review of this revision.Apr 1 2022, 2:31 AM
aganea added a comment.Apr 1 2022, 8:53 AM

Thanks for following up on this @CarlosAlbertoEnciso!

llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
179

There's no need to pass the Printer here, you already have a reference in HeaderScope.

195

Could you rather pass Printer.Filters as an argument rather?

209

Same here and below, HeaderScope.P could be used instead of passing it by arg.

llvm/include/llvm/DebugInfo/PDB/Native/LinePrinter.h
89

I think you can leave this function where it was initially, and instead just pass Filters as an argument at the call site. It doesn't need to know about the LinePrinter since they only need the Filters.

103

On a second thought, I think it'd better if this was a (const?) reference (FilterOptions &Filters), to make it explicit that the data is held somewhere else (by the caller).

llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
484

You shouldn't be needing those changes from here below.

Address feedback from @aganea:

Main points:

  • Use the Printer which is already in HeaderScope.
  • Keep shouldDumpSymbolGroup in the original location and pass Filters as argument.
llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
179

Very good point.

195

Now I am passing the Filters. I have to add extra logic because Filters should be optional<..>.

llvm/include/llvm/DebugInfo/PDB/Native/LinePrinter.h
89

The function has been moved to its original location.

103

Now is const reference.

Fix clang-format warning.

aganea added a comment.Apr 7 2022, 6:24 AM

Do you think it would be possible to omit Optional and just pass PrintScope &HeaderScope everywhere? It feels like without the printer, these functions don't have much purpose?

CarlosAlbertoEnciso updated this revision to Diff 421487.EditedApr 8 2022, 4:19 AM

As suggested by @aganea,

  • Omit Optional and just pass PrintScope &HeaderScope everywhere.
aganea accepted this revision.Apr 8 2022, 5:25 AM

LGTM, thanks again @CarlosAlbertoEnciso !

This revision is now accepted and ready to land.Apr 8 2022, 5:25 AM
This revision was landed with ongoing or failed builds.Apr 8 2022, 6:58 AM
This revision was automatically updated to reflect the committed changes.

Thanks for your review @aganea

aganea added a comment.Apr 8 2022, 7:04 AM

Thanks for your review @aganea

Thank you for your work and the patience! :-)

Thanks for your review @aganea

Thank you for your work and the patience! :-)

Happy to help. :-)