Skip to content

Commit 42e0ee4

Browse files
[Sema] Avoid repeated hash lookups (NFC) (#127301)
1 parent 8bdc312 commit 42e0ee4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16014,7 +16014,8 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) {
1601416014
llvm::DenseMap<const BlockDecl *, bool> EscapeInfo;
1601516015

1601616016
auto IsOrNestedInEscapingBlock = [&](const BlockDecl *BD) {
16017-
if (auto It = EscapeInfo.find(BD); It != EscapeInfo.end())
16017+
auto [It, Inserted] = EscapeInfo.try_emplace(BD);
16018+
if (!Inserted)
1601816019
return It->second;
1601916020

1602016021
bool R = false;
@@ -16027,7 +16028,7 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) {
1602716028
CurBD = CurBD->getParent()->getInnermostBlockDecl();
1602816029
} while (CurBD);
1602916030

16030-
return EscapeInfo[BD] = R;
16031+
return It->second = R;
1603116032
};
1603216033

1603316034
// If the location where 'self' is implicitly retained is inside a escaping

0 commit comments

Comments
 (0)