Skip to content

Commit ff9f1a6

Browse files
[Rewrite] Avoid repeated hash lookups (NFC) (#109605)
1 parent 9a33488 commit ff9f1a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Frontend/Rewrite/RewriteObjC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4358,21 +4358,21 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
43584358
for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++) {
43594359
DeclRefExpr *Exp = InnerBlockDeclRefs[i];
43604360
ValueDecl *VD = Exp->getDecl();
4361-
if (!VD->hasAttr<BlocksAttr>() && !BlockByCopyDeclsPtrSet.count(VD)) {
4361+
if (!VD->hasAttr<BlocksAttr>() &&
4362+
BlockByCopyDeclsPtrSet.insert(VD).second) {
43624363
// We need to save the copied-in variables in nested
43634364
// blocks because it is needed at the end for some of the API
43644365
// generations. See SynthesizeBlockLiterals routine.
43654366
InnerDeclRefs.push_back(Exp);
43664367
countOfInnerDecls++;
43674368
BlockDeclRefs.push_back(Exp);
4368-
BlockByCopyDeclsPtrSet.insert(VD);
43694369
BlockByCopyDecls.push_back(VD);
43704370
}
4371-
if (VD->hasAttr<BlocksAttr>() && !BlockByRefDeclsPtrSet.count(VD)) {
4371+
if (VD->hasAttr<BlocksAttr>() &&
4372+
BlockByRefDeclsPtrSet.insert(VD).second) {
43724373
InnerDeclRefs.push_back(Exp);
43734374
countOfInnerDecls++;
43744375
BlockDeclRefs.push_back(Exp);
4375-
BlockByRefDeclsPtrSet.insert(VD);
43764376
BlockByRefDecls.push_back(VD);
43774377
}
43784378
}

0 commit comments

Comments
 (0)