https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/107962

None

>From cc3832ba4c7c00de00346bde146420afeefc0b33 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Mon, 9 Sep 2024 07:33:21 -0700
Subject: [PATCH] [Format] Avoid repeated hash lookups (NFC)

---
 clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp 
b/clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp
index c91d6251425eab..f4016320c58591 100644
--- a/clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp
+++ b/clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp
@@ -86,9 +86,7 @@ void ObjCPropertyAttributeOrderFixer::sortPropertyAttributes(
       Value = Tok->TokenText;
     }
 
-    auto It = SortOrderMap.find(Attribute);
-    if (It == SortOrderMap.end())
-      It = SortOrderMap.insert({Attribute, SortOrderMap.size()}).first;
+    auto It = SortOrderMap.try_emplace(Attribute, SortOrderMap.size()).first;
 
     // Sort the indices based on the priority stored in `SortOrderMap`.
     const auto Ordinal = It->second;

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

Reply via email to