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

Function is_reachable

src/detector/memory/mod.rs:104–126  ·  view source on GitHub ↗
(from: Location, to: Location, body: &Body<'_>)

Source from the content-addressed store, hash-verified

102}
103
104fn is_reachable(from: Location, to: Location, body: &Body<'_>) -> bool {
105 if from.block == to.block {
106 return from.statement_index <= to.statement_index;
107 }
108 let from_block = from.block;
109 let to_block = to.block;
110 let mut worklist = Vec::new();
111 let mut visited = FxHashSet::default();
112 worklist.push(from_block);
113 visited.insert(from_block);
114 while let Some(curr) = worklist.pop() {
115 if curr == to_block {
116 return true;
117 }
118 for succ in body.basic_blocks[curr].terminator().successors() {
119 if !visited.insert(succ) {
120 continue;
121 }
122 worklist.push(succ);
123 }
124 }
125 false
126}

Callers 1

detect_use_after_dropFunction · 0.85

Calls 2

insertMethod · 0.80
successorsMethod · 0.45

Tested by

no test coverage detected