Skip to content

Commit c5c27d8

Browse files
[DebugInfo] Avoid repeated hash lookups (NFC) (#112298)
1 parent 5dca89c commit c5c27d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,11 @@ SymbolCache::findPublicSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
447447
std::vector<SymbolCache::LineTableEntry>
448448
SymbolCache::findLineTable(uint16_t Modi) const {
449449
// Check if this module has already been added.
450-
auto LineTableIter = LineTable.find(Modi);
451-
if (LineTableIter != LineTable.end())
450+
auto [LineTableIter, Inserted] = LineTable.try_emplace(Modi);
451+
if (!Inserted)
452452
return LineTableIter->second;
453453

454-
std::vector<LineTableEntry> &ModuleLineTable = LineTable[Modi];
454+
std::vector<LineTableEntry> &ModuleLineTable = LineTableIter->second;
455455

456456
// If there is an error or there are no lines, just return the
457457
// empty vector.

0 commit comments

Comments
 (0)