Struct rupta::graph::call_graph::CallGraph
source · 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>
impl<F: CGFunction, S: CGCallSite> CallGraph<F, S>
pub fn new() -> Self
pub fn set_callsite_type(&mut self, callsite: BaseCallSite, call_type: CallType)
pub fn get_callsite_type(&self, callsite: &BaseCallSite) -> Option<&CallType>
pub fn get_callee_id_of_edge(&self, edge_id: EdgeIndex) -> Option<F>
pub fn edge_endpoints(&self, edge_id: EdgeIndex) -> Option<(CGNodeId, CGNodeId)>
sourcepub fn get_callees(&self, callsite: &S) -> HashSet<F>
pub fn get_callees(&self, callsite: &S) -> HashSet<F>
Get the set of callees for a callsite.
sourcepub fn has_edge(&self, callsite: &S, callee_id: F) -> bool
pub fn has_edge(&self, callsite: &S, callee_id: F) -> bool
Returns true if an edge to the callee already existed for the callsite.
sourcepub fn add_edge(&mut self, callsite: S, caller_id: F, callee_id: F) -> bool
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.
sourcepub fn add_reach_func(&mut self, func: F)
pub fn add_reach_func(&mut self, func: F)
Add the def_id into the reachable functions queue.
sourcepub fn reach_funcs_iter(&self) -> IterCopied<F> ⓘ
pub fn reach_funcs_iter(&self) -> IterCopied<F> ⓘ
Return a iterator for the reachable functions.
sourcepub fn to_dot(&self, acx: &AnalysisContext<'_, '_>, dot_path: &Path)
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>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<F, S> !Send for CallGraph<F, S>
impl<F, S> !Sync for CallGraph<F, S>
impl<F, S> Unpin for CallGraph<F, S>
impl<F, S> UnwindSafe for CallGraph<F, S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more