pub struct CfgModule { /* private fields */ }Expand description
CFG module for control flow analysis.
§Examples
use forge_core::Forge;
let cfg = forge.cfg();
// Enumerate paths
let symbol_id = forge_core::types::SymbolId(1);
let paths = cfg.paths(symbol_id).execute().await?;Implementations§
Source§impl CfgModule
impl CfgModule
Sourcepub async fn index(&self) -> Result<()>
pub async fn index(&self) -> Result<()>
Indexes the codebase for CFG analysis.
Extracts CFG from C and Java source files using tree-sitter.
§Returns
Ok(()) on success, or an error if indexing fails.
Sourcepub async fn extract_function_cfg(
&self,
file_path: &Path,
function_name: &str,
) -> Result<Option<TestCfg>>
pub async fn extract_function_cfg( &self, file_path: &Path, function_name: &str, ) -> Result<Option<TestCfg>>
Extract CFG for a specific function from source
Sourcepub fn paths(&self, _function: SymbolId) -> PathBuilder
pub fn paths(&self, _function: SymbolId) -> PathBuilder
Sourcepub async fn dominators(&self, _function: SymbolId) -> Result<DominatorTree>
pub async fn dominators(&self, _function: SymbolId) -> Result<DominatorTree>
Computes dominators for a function.
Uses iterative dataflow analysis to compute the dominator tree. For C/Java functions, extracts real CFG using tree-sitter.
§Arguments
function- The function symbol ID
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CfgModule
impl RefUnwindSafe for CfgModule
impl Send for CfgModule
impl Sync for CfgModule
impl Unpin for CfgModule
impl UnsafeUnpin for CfgModule
impl UnwindSafe for CfgModule
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 more