MCPcopy Create free account
hub / github.com/CodeSentryAI/lockbud / add_partial_copy

Method add_partial_copy

src/analysis/pointsto/mod.rs:551–568  ·  view source on GitHub ↗

forall (p1, p2) where p1 is prefix of p1, add `p1 = p2`. e.g. Place1{local1, &[f0]}, Place2{local1, &[f0,f1]}, since they have the same local and Place1.projection is prefix of Place2.projection, Add constraint `Place1 = Place2`.

(&mut self)

Source from the content-addressed store, hash-verified

549 /// since they have the same local
550 /// and Place1.projection is prefix of Place2.projection,
551 /// Add constraint `Place1 = Place2`.
552 fn add_partial_copy(&mut self) {
553 let nodes = self.graph.nodes();
554 for (idx, n1) in nodes.iter().enumerate() {
555 for n2 in nodes.iter().skip(idx + 1) {
556 if let (ConstraintNode::Place(p1), ConstraintNode::Place(p2)) = (n1, n2) {
557 if p1.local == p2.local {
558 if p1.projection.len() > p2.projection.len() {
559 if &p1.projection[..p2.projection.len()] == p2.projection {
560 self.graph.add_copy(*p2, *p1);
561 }
562 } else if &p2.projection[..p1.projection.len()] == p1.projection {
563 self.graph.add_copy(*p1, *p2);
564 }
565 }
566 }
567 }
568 }
569 }
570
571 fn finish(mut self) -> ConstraintGraph<'tcx> {

Callers 1

finishMethod · 0.80

Calls 2

nodesMethod · 0.80
add_copyMethod · 0.80

Tested by

no test coverage detected