Skip to content

Commit 10bb124

Browse files
committed
pass via ref, and fix nits
1 parent ddf88b5 commit 10bb124

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class BinaryContext {
327327
bool isDWARFLegacyUsed() const { return ContainsDwarfLegacy; }
328328

329329
/// Returns true if DWARFUnit is valid.
330-
bool isValidDwarfUnit(DWARFUnit *const DU) const;
330+
bool isValidDwarfUnit(DWARFUnit &DU) const;
331331

332332
std::map<unsigned, DwarfLineTable> &getDwarfLineTables() {
333333
return DwarfLineTablesCUMap;

bolt/lib/Core/BinaryContext.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,15 +1624,15 @@ DWARFContext *BinaryContext::getDWOContext() const {
16241624
return &DWOCUs.begin()->second->getContext();
16251625
}
16261626

1627-
bool BinaryContext::isValidDwarfUnit(DWARFUnit *const DU) const {
1627+
bool BinaryContext::isValidDwarfUnit(DWARFUnit &DU) const {
16281628
// Invalid DWARF unit with a DWOId but lacking a dwo_name.
1629-
if (DU->getDWOId() && !DU->isDWOUnit() &&
1630-
!DU->getUnitDIE().find(
1629+
if (DU.getDWOId() && !DU.isDWOUnit() &&
1630+
!DU.getUnitDIE().find(
16311631
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name})) {
1632-
this->outs() << "BOLT-ERROR: Broken DWARF found in CU at offset 0x"
1633-
<< Twine::utohexstr(DU->getOffset()) << " (DWOId=0x"
1634-
<< Twine::utohexstr(*(DU->getDWOId()))
1635-
<< ", missing DW_AT_dwo_name / DW_AT_GNU_dwo_name).\n";
1632+
this->outs() << "BOLT-ERROR: broken DWARF found in CU at offset 0x"
1633+
<< Twine::utohexstr(DU.getOffset()) << " (DWOId=0x"
1634+
<< Twine::utohexstr(*(DU.getDWOId()))
1635+
<< ", missing DW_AT_dwo_name / DW_AT_GNU_dwo_name)\n";
16361636
return false;
16371637
}
16381638
return true;
@@ -1642,7 +1642,7 @@ bool BinaryContext::isValidDwarfUnit(DWARFUnit *const DU) const {
16421642
void BinaryContext::preprocessDWODebugInfo() {
16431643
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
16441644
DWARFUnit *const DwarfUnit = CU.get();
1645-
if (!isValidDwarfUnit(DwarfUnit))
1645+
if (!isValidDwarfUnit(*DwarfUnit))
16461646
continue;
16471647
if (std::optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
16481648
std::string DWOName = dwarf::toString(

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ static uint64_t getHash(const DWARFUnit &DU) {
10101010
}
10111011

10121012
bool DIEBuilder::registerUnit(DWARFUnit &DU, bool NeedSort) {
1013-
if (!BC.isValidDwarfUnit(&DU))
1013+
if (!BC.isValidDwarfUnit(DU))
10141014
return false;
10151015
auto IterGlobal = AllProcessed.insert(getHash(DU));
10161016
// If DU is already in a current working set or was already processed we can

bolt/test/X86/dwarf5-dwoid-no-dwoname.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -split-dwarf-file=main.dwo -o main.o
55
# RUN: %clang -O3 -g -gdwarf-5 -gsplit-dwarf -Wl,-q %t/main.o -o main.exe
66
# RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections 2>&1 | FileCheck %s --check-prefix=PRECHECK
7-
# PRECHECK: BOLT-ERROR: Broken DWARF found in CU at offset 0x3e (DWOId=0x0, missing DW_AT_dwo_name / DW_AT_GNU_dwo_name).
7+
# PRECHECK: BOLT-ERROR: broken DWARF found in CU at offset 0x3e (DWOId=0x0, missing DW_AT_dwo_name / DW_AT_GNU_dwo_name)
88

99
## Checks that Broken dwarf CU is removed
1010
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t/main.exe.bolt | FileCheck %s --check-prefix=POSTCHECK

0 commit comments

Comments
 (0)