Skip to main content

detect_dead_code

Function detect_dead_code 

Source
pub fn detect_dead_code<'a>(
    cpg: &'a CodePropertyGraph,
    entry_names: &[String],
) -> Vec<&'a Node>
Expand description

Finds functions that are not reachable from any of the specified entry functions via call edges.

§Arguments

  • cpg - The Code Property Graph.
  • entry_names - Names of functions that serve as entry points (e.g. ["main"]).

§Returns

A vector of references to unreachable function nodes. If no entry function is found, all functions are considered unreachable.