[clang] f6f0526 - [Sema] Avoid repeated hash lookups (NFC) (#126428)

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 9 13:33:06 PST 2025


Author: Kazu Hirata
Date: 2025-02-09T13:33:03-08:00
New Revision: f6f052625e77632bb672c5ea40d414f0f33fd5b1

URL: https://github.com/llvm/llvm-project/commit/f6f052625e77632bb672c5ea40d414f0f33fd5b1
DIFF: https://github.com/llvm/llvm-project/commit/f6f052625e77632bb672c5ea40d414f0f33fd5b1.diff

LOG: [Sema] Avoid repeated hash lookups (NFC) (#126428)

Added: 
    

Modified: 
    clang/lib/Sema/JumpDiagnostics.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp
index 4b92d67e49d7d73..ffbb9bc0bfe7cd0 100644
--- a/clang/lib/Sema/JumpDiagnostics.cpp
+++ b/clang/lib/Sema/JumpDiagnostics.cpp
@@ -786,8 +786,7 @@ void JumpScopeChecker::VerifyIndirectJumps() {
     if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(TheLabel->getStmt())))
       continue;
     unsigned LabelScope = LabelAndGotoScopes[TheLabel->getStmt()];
-    if (!TargetScopes.contains(LabelScope))
-      TargetScopes[LabelScope] = TheLabel;
+    TargetScopes.try_emplace(LabelScope, TheLabel);
   }
 
   // For each target scope, make sure it's trivially reachable from


        


More information about the cfe-commits mailing list