Index: lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- lib/CodeGen/CoverageMappingGen.cpp +++ lib/CodeGen/CoverageMappingGen.cpp @@ -1034,10 +1034,15 @@ std::vector Filenames; std::vector Expressions; std::vector Regions; + llvm::SmallVector FilenameStrs; llvm::SmallVector FilenameRefs; + FilenameStrs.resize(FileEntries.size()); FilenameRefs.resize(FileEntries.size()); - for (const auto &Entry : FileEntries) - FilenameRefs[Entry.second] = normalizeFilename(Entry.first->getName()); + for (const auto &Entry : FileEntries) { + auto I = Entry.second; + FilenameStrs[I] = normalizeFilename(Entry.first->getName()); + FilenameRefs[I] = FilenameStrs[I]; + } RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames, Expressions, Regions); if (Reader.read())