Skip to content

Commit 9b30d66

Browse files
kazutakahirataDanielCChen
authored andcommitted
[Sema] Avoid repeated hash lookups (NFC) (llvm#112071)
1 parent 153f962 commit 9b30d66

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/Sema/SemaTemplateDeduction.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,11 +4057,10 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction(
40574057
// keep track of these diagnostics. They'll be emitted if this specialization
40584058
// is actually used.
40594059
if (Info.diag_begin() != Info.diag_end()) {
4060-
SuppressedDiagnosticsMap::iterator
4061-
Pos = SuppressedDiagnostics.find(Specialization->getCanonicalDecl());
4062-
if (Pos == SuppressedDiagnostics.end())
4063-
SuppressedDiagnostics[Specialization->getCanonicalDecl()]
4064-
.append(Info.diag_begin(), Info.diag_end());
4060+
auto [Pos, Inserted] =
4061+
SuppressedDiagnostics.try_emplace(Specialization->getCanonicalDecl());
4062+
if (Inserted)
4063+
Pos->second.append(Info.diag_begin(), Info.diag_end());
40654064
}
40664065

40674066
return TemplateDeductionResult::Success;

0 commit comments

Comments
 (0)