Trait RangeAnalysis

Source
pub trait RangeAnalysis<'tcx, T: IntervalArithmetic + ConstConvert + Debug>: Analysis {
    // Required methods
    fn get_fn_range(&self, def_id: DefId) -> Option<RAResult<'tcx, T>>;
    fn get_fn_ranges_percall(
        &self,
        def_id: DefId,
    ) -> Option<Vec<RAResult<'tcx, T>>>;
    fn get_all_fn_ranges(&self) -> RAResultMap<'tcx, T>;
    fn get_all_fn_ranges_percall(&self) -> RAVecResultMap<'tcx, T>;
    fn get_fn_local_range(
        &self,
        def_id: DefId,
        local: Place<'tcx>,
    ) -> Option<Range<T>>;
    fn get_fn_path_constraints(
        &self,
        def_id: DefId,
    ) -> Option<PathConstraint<'tcx>>;
    fn get_all_path_constraints(&self) -> PathConstraintMap<'tcx>;
}
Expand description

The core trait for performing range analysis over Rust MIR.

This trait provides access to both intra-procedural and inter-procedural range results inferred through static interval analysis.

Required Methods§

Source

fn get_fn_range(&self, def_id: DefId) -> Option<RAResult<'tcx, T>>

The fucntion returns the range information for all local variables (Places) in a given function specified by def_id.

Source

fn get_fn_ranges_percall(&self, def_id: DefId) -> Option<Vec<RAResult<'tcx, T>>>

The function returns the range analysis results for each call instance of the specified function. This is useful in interprocedural or context-sensitive analyses, where a function might be analyzed multiple times under different calling contexts.

Source

fn get_all_fn_ranges(&self) -> RAResultMap<'tcx, T>

The function returns the complete mapping of range information for all functions in the crate.

Source

fn get_all_fn_ranges_percall(&self) -> RAVecResultMap<'tcx, T>

The function returns the range results for every call instance of every function in the crate.

Source

fn get_fn_local_range( &self, def_id: DefId, local: Place<'tcx>, ) -> Option<Range<T>>

The function returns the inferred range for a specific variable (Place) in a specific function.

Source

fn get_fn_path_constraints(&self, def_id: DefId) -> Option<PathConstraint<'tcx>>

The function returns a mapping from feasible control-flow paths to symbolic constraints. Each constraint is a triple of (Place, Place, BinOp) representing path-sensitive relational information useful for pruning infeasible paths.

Source

fn get_all_path_constraints(&self) -> PathConstraintMap<'tcx>

The function returns path constraints for all functions in the crate.

Implementors§

Source§

impl<'tcx, T> RangeAnalysis<'tcx, T> for RangeAnalyzer<'tcx, T>