[clang] 9c2fc17 - [Sema] Avoid repeated hash lookups (NFC) (#112071)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 12 08:00:35 PDT 2024
Author: Kazu Hirata
Date: 2024-10-12T08:00:31-07:00
New Revision: 9c2fc17ee79eea7e18964d3d1b910dd8c1d7e733
URL: https://github.com/llvm/llvm-project/commit/9c2fc17ee79eea7e18964d3d1b910dd8c1d7e733
DIFF: https://github.com/llvm/llvm-project/commit/9c2fc17ee79eea7e18964d3d1b910dd8c1d7e733.diff
LOG: [Sema] Avoid repeated hash lookups (NFC) (#112071)
Added:
Modified:
clang/lib/Sema/SemaTemplateDeduction.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index aa62cfa7dcbd17..7cfb8d687c796a 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -4057,11 +4057,10 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction(
// keep track of these diagnostics. They'll be emitted if this specialization
// is actually used.
if (Info.diag_begin() != Info.diag_end()) {
- SuppressedDiagnosticsMap::iterator
- Pos = SuppressedDiagnostics.find(Specialization->getCanonicalDecl());
- if (Pos == SuppressedDiagnostics.end())
- SuppressedDiagnostics[Specialization->getCanonicalDecl()]
- .append(Info.diag_begin(), Info.diag_end());
+ auto [Pos, Inserted] =
+ SuppressedDiagnostics.try_emplace(Specialization->getCanonicalDecl());
+ if (Inserted)
+ Pos->second.append(Info.diag_begin(), Info.diag_end());
}
return TemplateDeductionResult::Success;
More information about the cfe-commits
mailing list