[clang] [Frontend] Avoid repeated hash lookups (NFC) (PR #108738)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 15 00:07:43 PDT 2024
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/108738.diff
1 Files Affected:
- (modified) clang/lib/Frontend/Rewrite/RewriteObjC.cpp (+1-2)
``````````diff
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";
``````````
</details>
https://github.com/llvm/llvm-project/pull/108738
More information about the cfe-commits
mailing list