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;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to