pub struct CallGraph {
pub edges: Vec<CallEdge>,
pub callers: HashMap<FunctionRef, HashSet<FunctionRef>>,
pub callees: HashMap<FunctionRef, HashSet<FunctionRef>>,
/* private fields */
}Expand description
Complete call graph for a project.
Fields§
§edges: Vec<CallEdge>All call edges
callers: HashMap<FunctionRef, HashSet<FunctionRef>>Index: callee -> callers (who calls this?)
callees: HashMap<FunctionRef, HashSet<FunctionRef>>Index: caller -> callees (what does this call?)
Implementations§
Source§impl CallGraph
impl CallGraph
Sourcepub fn from_edges(edges: Vec<CallEdge>) -> Self
pub fn from_edges(edges: Vec<CallEdge>) -> Self
Create a new CallGraph from edges.
Indexes are not built automatically. Call build_indexes() after creation.
Sourcepub fn build_indexes(&mut self)
pub fn build_indexes(&mut self)
Build indexes from edges (call after deserialization).
Sourcepub fn invalidate_caches(&mut self)
pub fn invalidate_caches(&mut self)
Invalidate all caches (call after modifying edges).
Sourcepub fn get_callees(
&self,
source: &FunctionRef,
depth: usize,
) -> HashSet<FunctionRef>
pub fn get_callees( &self, source: &FunctionRef, depth: usize, ) -> HashSet<FunctionRef>
Forward call graph: what does function X call?
Uses partial matching via FunctionRef::matches() to find the source function,
then performs BFS traversal up to the specified depth.
Sourcepub fn all_functions(&self) -> &HashSet<FunctionRef>
pub fn all_functions(&self) -> &HashSet<FunctionRef>
Get all unique functions in the graph (cached).
The result is lazily computed on first access and cached for subsequent calls.
The cache is automatically invalidated when build_indexes() or
invalidate_caches() is called.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CallGraph
impl<'de> Deserialize<'de> for CallGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for CallGraph
impl !RefUnwindSafe for CallGraph
impl Send for CallGraph
impl !Sync for CallGraph
impl Unpin for CallGraph
impl UnwindSafe for CallGraph
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request