paralegal_policy

Trait NodeQueries

Source
pub trait NodeQueries<'a>: IntoIterGlobalNodes
where Self::Iter: 'a,
{ // Provided methods fn siblings(self, ctx: &RootContext) -> NodeCluster { ... } fn flows_to( self, sink: impl IntoIterGlobalNodes, ctx: &RootContext, edge_type: EdgeSelection, ) -> bool { ... } fn find_flow( self, sink: impl IntoIterGlobalNodes, ctx: &RootContext, edge_type: EdgeSelection, ) -> Option<GlobalNode> { ... } fn consuming_call_sites( self, ctx: &'a RootContext, ) -> Box<dyn Iterator<Item = CallString> + 'a> { ... } fn has_ctrl_influence( self, target: impl IntoIterGlobalNodes, ctx: &RootContext, ) -> bool { ... } fn influencers( self, ctx: &RootContext, edge_type: EdgeSelection, ) -> Vec<GlobalNode> { ... } fn influencees( self, ctx: &RootContext, edge_type: EdgeSelection, ) -> Vec<GlobalNode> { ... } }
Expand description

Context queries conveniently accessible on nodes

Provided Methods§

Source

fn siblings(self, ctx: &RootContext) -> NodeCluster

Get other nodes at the same instruction

Source

fn flows_to( self, sink: impl IntoIterGlobalNodes, ctx: &RootContext, 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 RootContext::has_ctrl_influence, which additionally considers intermediate nodes which the src node has data flow to and has ctrl influence on the sink.

Source

fn find_flow( self, sink: impl IntoIterGlobalNodes, ctx: &RootContext, edge_type: EdgeSelection, ) -> Option<GlobalNode>

Returns the sink node that is reached

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 RootContext::has_ctrl_influence, which additionally considers intermediate nodes which the src node has data flow to and has ctrl influence on the sink.

Source

fn consuming_call_sites( self, ctx: &'a RootContext, ) -> Box<dyn Iterator<Item = CallString> + 'a>

Call sites that consume this node directly. E.g. the outgoing edges.

Source

fn has_ctrl_influence( self, target: impl IntoIterGlobalNodes, ctx: &RootContext, ) -> 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).

Source

fn influencers( self, ctx: &RootContext, 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.

Source

fn influencees( self, ctx: &RootContext, 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, T: IntoIterGlobalNodes + 'a> NodeQueries<'a> for T