================
@@ -235,6 +266,20 @@ class FactSet {
     return false;
   }
 
+  std::optional<FactID> replaceLock(FactManager &FM, iterator It,
+                                    std::unique_ptr<FactEntry> Entry) {
+    if (It == end())
+      return std::nullopt;
+    FactID F = FM.newFact(std::move(Entry));
+    *It = F;
+    return F;
+  }
+
+  std::optional<FactID> replaceLock(FactManager &FM, const CapabilityExpr 
&CapE,
+                                    std::unique_ptr<FactEntry> Entry) {
+    return replaceLock(FM, findLockIter(FM, CapE), std::move(Entry));
+  }
+
----------------
melver wrote:

replaceLock without caller-iterator still saves a copy+pop_back+push_back. Not 
much, but not nothing either.

This PR should include the bare minimum use of replaceLock - I have one patch 
queued that is not part of this PR to do an unrelated substitution with 
replaceLock.

If anything I'd move replaceLock introduction before this PR, but I think we're 
just splitting hairs at that point.

https://github.com/llvm/llvm-project/pull/137133
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to