Skip to content

Commit 08085ed

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#107759)
1 parent 4cab4f4 commit 08085ed

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,12 +2595,7 @@ void CoverageMappingModuleGen::emit() {
25952595
}
25962596

25972597
unsigned CoverageMappingModuleGen::getFileID(FileEntryRef File) {
2598-
auto It = FileEntries.find(File);
2599-
if (It != FileEntries.end())
2600-
return It->second;
2601-
unsigned FileID = FileEntries.size() + 1;
2602-
FileEntries.insert(std::make_pair(File, FileID));
2603-
return FileID;
2598+
return FileEntries.try_emplace(File, FileEntries.size() + 1).first->second;
26042599
}
26052600

26062601
void CoverageMappingGen::emitCounterMapping(const Decl *D,

0 commit comments

Comments
 (0)