pub struct CallGraph<F: CGFunction, S: CGCallSite> {
    pub graph: Graph<CallGraphNode<F>, CallGraphEdge<S>>,
    pub func_nodes: HashMap<F, CGNodeId>,
    pub callsite_to_edges: HashMap<S, HashSet<CGEdgeId>>,
    /* private fields */
}

Fields§

§graph: Graph<CallGraphNode<F>, CallGraphEdge<S>>

The graph structure capturing call relationships.

§func_nodes: HashMap<F, CGNodeId>

A map from functions to their corresponding call graph nodes.

§callsite_to_edges: HashMap<S, HashSet<CGEdgeId>>

A map from call sites to call graph edges.

Implementations§

source§

impl<F: CGFunction, S: CGCallSite> CallGraph<F, S>

source

pub fn new() -> Self

source

pub fn add_node(&mut self, func: F)

Add a new node to the call graph.

source

pub fn set_callsite_type(&mut self, callsite: BaseCallSite, call_type: CallType)

source

pub fn get_callsite_type(&self, callsite: &BaseCallSite) -> Option<&CallType>

source

pub fn get_callee_id_of_edge(&self, edge_id: EdgeIndex) -> Option<F>

source

pub fn edge_endpoints(&self, edge_id: EdgeIndex) -> Option<(CGNodeId, CGNodeId)>

source

pub fn get_callees(&self, callsite: &S) -> HashSet<F>

Get the set of callees for a callsite.

source

pub fn has_edge(&self, callsite: &S, callee_id: F) -> bool

Returns true if an edge to the callee already existed for the callsite.

source

pub fn add_edge(&mut self, callsite: S, caller_id: F, callee_id: F) -> bool

Adds a new edge to the call graph. The edge is a call from caller_id to callee_id at callsite. Returns false if the edge already existed, and true otherwise.

source

pub fn add_reach_func(&mut self, func: F)

Add the def_id into the reachable functions queue.

source

pub fn reach_funcs_iter(&self) -> IterCopied<F>

Return a iterator for the reachable functions.

source

pub fn to_dot(&self, acx: &AnalysisContext<'_, '_>, dot_path: &Path)

Produce a dot file representation of the call graph for displaying with Graphviz.

Auto Trait Implementations§

§

impl<F, S> RefUnwindSafe for CallGraph<F, S>

§

impl<F, S> !Send for CallGraph<F, S>

§

impl<F, S> !Sync for CallGraph<F, S>

§

impl<F, S> Unpin for CallGraph<F, S>
where F: Unpin, S: Unpin,

§

impl<F, S> UnwindSafe for CallGraph<F, S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.