[clang] ba7a0b7 - [Frontend] Avoid repeated hash lookups (NFC) (#108738)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 15 01:21:03 PDT 2024
Author: Kazu Hirata
Date: 2024-09-15T01:21:00-07:00
New Revision: ba7a0b725c67e9c3a31f5ffedb6fbe4c5237ac56
URL: https://github.com/llvm/llvm-project/commit/ba7a0b725c67e9c3a31f5ffedb6fbe4c5237ac56
DIFF: https://github.com/llvm/llvm-project/commit/ba7a0b725c67e9c3a31f5ffedb6fbe4c5237ac56.diff
LOG: [Frontend] Avoid repeated hash lookups (NFC) (#108738)
Added:
Modified:
clang/lib/Frontend/Rewrite/RewriteObjC.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
index 9db6ddbf0b8908..fd5e8dc5298950 100644
--- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -4111,9 +4111,8 @@ void RewriteObjC::RewriteBlockPointerDecl(NamedDecl *ND) {
std::string RewriteObjC::SynthesizeByrefCopyDestroyHelper(VarDecl *VD,
int flag) {
std::string S;
- if (CopyDestroyCache.count(flag))
+ if (!CopyDestroyCache.insert(flag).second)
return S;
- CopyDestroyCache.insert(flag);
S = "static void __Block_byref_id_object_copy_";
S += utostr(flag);
S += "(void *dst, void *src) {\n";
More information about the cfe-commits
mailing list