diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp index 1a31aa206dfcc..463b9ebe3cbff 100644 --- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp @@ -447,11 +447,11 @@ SymbolCache::findPublicSymbolBySectOffset(uint32_t Sect, uint32_t Offset) { std::vector SymbolCache::findLineTable(uint16_t Modi) const { // Check if this module has already been added. - auto LineTableIter = LineTable.find(Modi); - if (LineTableIter != LineTable.end()) + auto [LineTableIter, Inserted] = LineTable.try_emplace(Modi); + if (!Inserted) return LineTableIter->second; - std::vector &ModuleLineTable = LineTable[Modi]; + std::vector &ModuleLineTable = LineTableIter->second; // If there is an error or there are no lines, just return the // empty vector.