[clang] a56eb7c - [Sema] Avoid repeated hash lookups (NFC) (#122588)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 13:15:53 PST 2025


Author: Kazu Hirata
Date: 2025-01-11T13:15:50-08:00
New Revision: a56eb7c9986456ae4b492fff79c3cf18d0ef8ad3

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

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8724c20fd7b652..5b7275c316f74a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15868,8 +15868,8 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) {
   llvm::DenseMap<const BlockDecl *, bool> EscapeInfo;
 
   auto IsOrNestedInEscapingBlock = [&](const BlockDecl *BD) {
-    if (EscapeInfo.count(BD))
-      return EscapeInfo[BD];
+    if (auto It = EscapeInfo.find(BD); It != EscapeInfo.end())
+      return It->second;
 
     bool R = false;
     const BlockDecl *CurBD = BD;


        


More information about the cfe-commits mailing list