diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -63,7 +63,7 @@ TypeServerSource *tSrc = (TypeServerSource *)it.first->second; log("GUID collision between " + file.getFilePath() + " and " + tSrc->pdbInputFile->session->getPDBFile().getFilePath()); - ctx.typeServerSourceMappings.erase(Guid); + it.first->second = nullptr; } } @@ -405,11 +405,14 @@ const codeview::GUID &tsId = typeServerDependency.getGuid(); StringRef tsPath = typeServerDependency.getName(); - TypeServerSource *tsSrc; + TypeServerSource *tsSrc = nullptr; auto it = ctx.typeServerSourceMappings.find(tsId); if (it != ctx.typeServerSourceMappings.end()) { tsSrc = (TypeServerSource *)it->second; - } else { + } + + // check for nullptr since we insert nullptr if we encounter a collision + if (tsSrc == nullptr) { // The file failed to load, lookup by name PDBInputFile *pdb = PDBInputFile::findFromRecordPath(ctx, tsPath, file); if (!pdb)