Skip to content

Commit 6f32d5e

Browse files
[DWARF] Avoid repeated hash lookups (NFC) (#125633)
1 parent c0f7ebe commit 6f32d5e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -967,21 +967,20 @@ void DWARFVerifier::verifyDebugLineStmtOffsets() {
967967
// here because we validate this in the .debug_info verifier.
968968
continue;
969969
}
970-
auto Iter = StmtListToDie.find(LineTableOffset);
971-
if (Iter != StmtListToDie.end()) {
970+
auto [Iter, Inserted] = StmtListToDie.try_emplace(LineTableOffset, Die);
971+
if (!Inserted) {
972972
++NumDebugLineErrors;
973+
const auto &OldDie = Iter->second;
973974
ErrorCategory.Report("Identical DW_AT_stmt_list section offset", [&]() {
974975
error() << "two compile unit DIEs, "
975-
<< format("0x%08" PRIx64, Iter->second.getOffset()) << " and "
976+
<< format("0x%08" PRIx64, OldDie.getOffset()) << " and "
976977
<< format("0x%08" PRIx64, Die.getOffset())
977978
<< ", have the same DW_AT_stmt_list section offset:\n";
978-
dump(Iter->second);
979+
dump(OldDie);
979980
dump(Die) << '\n';
980981
});
981982
// Already verified this line table before, no need to do it again.
982-
continue;
983983
}
984-
StmtListToDie[LineTableOffset] = Die;
985984
}
986985
}
987986

0 commit comments

Comments
 (0)