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

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 9 11:36:59 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/126428.diff


1 Files Affected:

- (modified) clang/lib/Sema/JumpDiagnostics.cpp (+1-2) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/126428


More information about the cfe-commits mailing list