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

Method insert_edge

src/analysis/pointsto/mod.rs:386–403  ·  view source on GitHub ↗

if edge `from--|weight|-->to` not exists, then add the edge and return true

(
        &mut self,
        from: ConstraintNode<'tcx>,
        to: ConstraintNode<'tcx>,
        weight: ConstraintEdge,
    )

Source from the content-addressed store, hash-verified

384 /// if edge `from--|weight|-->to` not exists,
385 /// then add the edge and return true
386 fn insert_edge(
387 &mut self,
388 from: ConstraintNode<'tcx>,
389 to: ConstraintNode<'tcx>,
390 weight: ConstraintEdge,
391 ) -> bool {
392 let from = self.get_node(&from).unwrap();
393 let to = self.get_node(&to).unwrap();
394 if let Some(edge) = self.graph.find_edge(from, to) {
395 if let Some(w) = self.graph.edge_weight(edge) {
396 if *w == weight {
397 return false;
398 }
399 }
400 }
401 self.graph.add_edge(from, to, weight);
402 true
403 }
404
405 /// Print the callgraph in dot format.
406 #[allow(dead_code)]

Callers 1

analyzeMethod · 0.80

Calls 2

get_nodeMethod · 0.80
add_edgeMethod · 0.80

Tested by

no test coverage detected