Code cleanup for DwarfCUToModule::NullWarningReporter changes.

Updated code to use Google's modern C++ style.

* Use std::unique_ptr to allocate DwarfCUToModule::WarningReporter.
* Fixed reference alignment in NullWarningReporter.

Change-Id: I230dac445a07b4023a64284b907010f31eadcdf4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5265662
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
Nathan Moinvaziri 2024-02-05 13:44:35 -08:00 committed by Ivan Penkov
parent 38ac9ae56f
commit 6b871f4bd8
2 changed files with 21 additions and 22 deletions

View file

@ -256,8 +256,8 @@ class DwarfCUToModule: public RootDIEHandler {
class NullWarningReporter : public WarningReporter {
public:
NullWarningReporter(const string &filename, uint64_t cu_offset):
WarningReporter(filename, cu_offset) { }
NullWarningReporter(const string& filename, uint64_t cu_offset)
: WarningReporter(filename, cu_offset) {}
// Set the name of the compilation unit we're processing to NAME.
void SetCUName(const string& name) {}

View file

@ -528,12 +528,12 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
for (uint64_t offset = 0; offset < debug_info_length;) {
// Make a handler for the root DIE that populates MODULE with the
// debug info.
DwarfCUToModule::WarningReporter *reporter = nullptr;
std::unique_ptr<DwarfCUToModule::WarningReporter> reporter;
if (report_warnings_) {
reporter = new DwarfCUToModule::WarningReporter(
reporter = std::make_unique<DwarfCUToModule::WarningReporter>(
selected_object_name_, offset);
} else {
reporter = new DwarfCUToModule::NullWarningReporter(
reporter = std::make_unique<DwarfCUToModule::NullWarningReporter>(
selected_object_name_, offset);
}
DwarfCUToModule root_handler(&file_context, &line_to_module,
@ -554,7 +554,6 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
StartProcessSplitDwarf(&dwarf_reader, module, endianness,
handle_inter_cu_refs, handle_inline);
}
delete reporter;
}
}