Author: Kazu Hirata Date: 2024-09-23T06:42:46-07:00 New Revision: ff9f1a6ea2a0031387d23ce510d43edd81a18a1e
URL: https://github.com/llvm/llvm-project/commit/ff9f1a6ea2a0031387d23ce510d43edd81a18a1e DIFF: https://github.com/llvm/llvm-project/commit/ff9f1a6ea2a0031387d23ce510d43edd81a18a1e.diff LOG: [Rewrite] Avoid repeated hash lookups (NFC) (#109605) 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 180a0125023ee7..ac5baf72a65c90 100644 --- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -4358,21 +4358,21 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++) { DeclRefExpr *Exp = InnerBlockDeclRefs[i]; ValueDecl *VD = Exp->getDecl(); - if (!VD->hasAttr<BlocksAttr>() && !BlockByCopyDeclsPtrSet.count(VD)) { + if (!VD->hasAttr<BlocksAttr>() && + BlockByCopyDeclsPtrSet.insert(VD).second) { // We need to save the copied-in variables in nested // blocks because it is needed at the end for some of the API // generations. See SynthesizeBlockLiterals routine. InnerDeclRefs.push_back(Exp); countOfInnerDecls++; BlockDeclRefs.push_back(Exp); - BlockByCopyDeclsPtrSet.insert(VD); BlockByCopyDecls.push_back(VD); } - if (VD->hasAttr<BlocksAttr>() && !BlockByRefDeclsPtrSet.count(VD)) { + if (VD->hasAttr<BlocksAttr>() && + BlockByRefDeclsPtrSet.insert(VD).second) { InnerDeclRefs.push_back(Exp); countOfInnerDecls++; BlockDeclRefs.push_back(Exp); - BlockByRefDeclsPtrSet.insert(VD); BlockByRefDecls.push_back(VD); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits