0
0
mirror of https://github.com/llvm/llvm-project.git synced 2025-04-27 03:16:07 +00:00

[clang-apply-replacements] Avoid repeated hash lookups (NFC) ()

This commit is contained in:
Kazu Hirata 2024-10-10 08:15:48 -07:00 committed by GitHub
parent 058ede06c4
commit 77c842f44c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -148,11 +148,8 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
if (auto Entry = SM.getFileManager().getOptionalFileRef(Path)) {
if (SourceTU) {
auto &Replaces = DiagReplacements[*Entry];
auto It = Replaces.find(R);
if (It == Replaces.end())
Replaces.emplace(R, SourceTU);
else if (It->second != SourceTU)
auto [It, Inserted] = DiagReplacements[*Entry].try_emplace(R, SourceTU);
if (!Inserted && It->second != SourceTU)
// This replacement is a duplicate of one suggested by another TU.
return;
}