Trait paralegal_policy::context::NodeQueries
source · pub trait NodeQueries<'a>: IntoIterGlobalNodeswhere
Self::Iter: 'a,{
// Provided methods
fn siblings(self, ctx: &Context) -> NodeCluster { ... }
fn flows_to(
self,
sink: impl IntoIterGlobalNodes,
ctx: &Context,
edge_type: EdgeSelection
) -> bool { ... }
fn consuming_call_sites(
self,
ctx: &'a Context
) -> Box<dyn Iterator<Item = CallString> + 'a> { ... }
fn has_ctrl_influence(
self,
target: impl IntoIterGlobalNodes + Sized + Copy,
ctx: &Context
) -> bool { ... }
fn influencers(
self,
ctx: &Context,
edge_type: EdgeSelection
) -> Vec<GlobalNode> { ... }
fn influencees(
self,
ctx: &Context,
edge_type: EdgeSelection
) -> Vec<GlobalNode> { ... }
}
Expand description
Context queries conveniently accessible on nodes
Provided Methods§
sourcefn siblings(self, ctx: &Context) -> NodeCluster
fn siblings(self, ctx: &Context) -> NodeCluster
Get other nodes at the same instruction
sourcefn flows_to(
self,
sink: impl IntoIterGlobalNodes,
ctx: &Context,
edge_type: EdgeSelection
) -> bool
fn flows_to( self, sink: impl IntoIterGlobalNodes, ctx: &Context, edge_type: EdgeSelection ) -> bool
Returns whether a node flows to a node through the configured edge type.
Nodes do not flow to themselves. CallArgument nodes do flow to their respective CallSites.
If you use flows_to with EdgeSelection::Control
, you might want to consider using Context::has_ctrl_influence
, which additionally considers intermediate nodes which the src node has data flow to and has ctrl influence on the sink.
sourcefn consuming_call_sites(
self,
ctx: &'a Context
) -> Box<dyn Iterator<Item = CallString> + 'a>
fn consuming_call_sites( self, ctx: &'a Context ) -> Box<dyn Iterator<Item = CallString> + 'a>
Call sites that consume this node directly. E.g. the outgoing edges.
sourcefn has_ctrl_influence(
self,
target: impl IntoIterGlobalNodes + Sized + Copy,
ctx: &Context
) -> bool
fn has_ctrl_influence( self, target: impl IntoIterGlobalNodes + Sized + Copy, ctx: &Context ) -> bool
Returns whether there is direct control flow influence from influencer to sink, or there is some node which is data-flow influenced by influencer
and has direct control flow influence on target
. Or as expressed in code:
some n where self.flows_to(influencer, n, EdgeSelection::Data) && self.flows_to(n, target, EdgeSelection::Control)
.
sourcefn influencers(self, ctx: &Context, edge_type: EdgeSelection) -> Vec<GlobalNode>
fn influencers(self, ctx: &Context, edge_type: EdgeSelection) -> Vec<GlobalNode>
Returns iterator over all Nodes that influence the given sink Node.
Does not return the input node. A CallSite sink will return all of the associated CallArgument nodes.
sourcefn influencees(self, ctx: &Context, edge_type: EdgeSelection) -> Vec<GlobalNode>
fn influencees(self, ctx: &Context, edge_type: EdgeSelection) -> Vec<GlobalNode>
Returns iterator over all Nodes that are influenced by the given src Node.
Does not return the input node. A CallArgument src will return the associated CallSite.