prehistoric-penguin updated this revision to Diff 449581. prehistoric-penguin added a comment.
Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131046/new/ https://reviews.llvm.org/D131046 Files: clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp Index: clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp =================================================================== --- clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp +++ clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp @@ -168,11 +168,9 @@ if (auto Entry = SM.getFileManager().getFile(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) - // This replacement is a duplicate of one suggested by another TU. + auto InsertPos = Replaces.try_emplace(R, SourceTU); + // This replacement is a duplicate of one suggested by another TU. + if (!InsertPos.second && InsertPos.first->second != SourceTU) return; } GroupedReplacements[*Entry].push_back(R);
Index: clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp =================================================================== --- clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp +++ clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp @@ -168,11 +168,9 @@ if (auto Entry = SM.getFileManager().getFile(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) - // This replacement is a duplicate of one suggested by another TU. + auto InsertPos = Replaces.try_emplace(R, SourceTU); + // This replacement is a duplicate of one suggested by another TU. + if (!InsertPos.second && InsertPos.first->second != SourceTU) return; } GroupedReplacements[*Entry].push_back(R);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits