Skip to content

Commit a0f216f

Browse files
authored
try_emplace
1 parent 11055e3 commit a0f216f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ static llvm::BitVector computePersistentOrigins(FactManager &FactMgr,
2727
auto CheckOrigin = [&](OriginID OID) {
2828
if (PersistentOrigins.test(OID.Value))
2929
return;
30-
auto It = OriginToBlock.find(OID);
30+
auto [It, Inserted] = OriginToBlock.try_emplace(OID, B);
31+
if (!Inserted && It->second != B) {
32+
// We saw this origin in more than one block.
33+
PersistentOrigins.set(OID.Value);
34+
}
3135
if (It == OriginToBlock.end())
3236
OriginToBlock[OID] = B;
3337
else if (It->second != B) {

0 commit comments

Comments
 (0)