SafeDropGraph

Struct SafeDropGraph 

Source
pub struct SafeDropGraph<'tcx> {
    pub alias_graph: AliasGraph<'tcx>,
    pub bug_records: BugRecords,
    pub drop_record: Vec<DropRecord>,
    pub adt_owner: OHAResultMap,
}
Expand description

We represent each target function with the SafeDropGraph struct and then perform analysis based on the struct.

Fields§

§alias_graph: AliasGraph<'tcx>§bug_records: BugRecords§drop_record: Vec<DropRecord>§adt_owner: OHAResultMap

Implementations§

Source§

impl<'tcx> SafeDropGraph<'tcx>

Source

pub fn alias_bb(&mut self, bb_index: usize)

Source

pub fn alias_bbcall(&mut self, bb_index: usize, fn_map: &MopFnAliasMap)

Source§

impl<'tcx> SafeDropGraph<'tcx>

Source

pub fn add_to_drop_record( &mut self, value_idx: usize, bb_idx: usize, flag_cleanup: bool, )

Source

pub fn push_drop_info(&mut self, value_idx: usize, drop_spot: LocalSpot)

Source

pub fn push_drop_top_down(&mut self, value_idx: usize, drop_spot: LocalSpot)

drop the fields of the root node.

Source

pub fn push_drop_bottom_up(&mut self, value_idx: usize, drop_spot: LocalSpot)

Source

pub fn fetch_drop_info(&mut self, value_idx: usize)

Source

pub fn clear_drop_info(&mut self, value_idx: usize)

Source

pub fn clear_father_drop(&mut self, value_idx: usize)

Source

pub fn clear_field_drop(&mut self, value_idx: usize)

Source

pub fn fetch_drop_from_bottom(&mut self, value_idx: usize)

Source

pub fn fetch_drop_from_top(&mut self, value_idx: usize)

Source

pub fn fetch_drop_from_alias(&mut self, value_idx: usize)

Source§

impl<'tcx> SafeDropGraph<'tcx>

Source

pub fn new(tcx: TyCtxt<'tcx>, def_id: DefId, adt_owner: OHAResultMap) -> Self

Source

pub fn from_path_graph( tcx: TyCtxt<'tcx>, def_id: DefId, path_graph: PathGraph<'tcx>, adt_owner: OHAResultMap, ) -> Self

Source

pub fn sync_drop_record(&mut self)

Ensure drop_record matches the current length of alias_graph.values. Call this after any alias operation that may create new value nodes (projection, sync_field_alias, sync_father_alias, handle_fn_alias, etc.).

Source§

impl<'tcx> SafeDropGraph<'tcx>

Source

pub fn drop_check(&mut self, bb_idx: usize)

Source

pub fn drop_heap_item_check(&self, place: &Place<'tcx>) -> bool

Source

pub fn process_function_paths(&mut self, fn_map: &MopFnAliasMap)

Process pre-enumerated whole-function paths for SafeDrop via DFS on the path tree. All paths have already been filtered by incremental constraint-based reachability checks during enumeration, so no per-path filtering is needed. State is saved at branch points and restored before each sibling subtree.

Source

pub fn process_function_paths_opt( &mut self, precomputed_paths: Option<PathTree>, fn_map: &MopFnAliasMap, )

Source

fn dfs_safedrop( &mut self, node: &PathNode, path: &mut Vec<usize>, fn_map: &MopFnAliasMap, ) -> Result<(), ()>

Source

pub fn report_bugs(&self)

Source

fn make_bug( &self, idx: usize, trigger_info: LocalSpot, span: Span, confidence: usize, bug_type: BugType, ) -> TyBug

Source

fn check_drop_status(&mut self, idx: usize) -> Option<usize>

Source

pub fn uaf_check( &mut self, value_idx: usize, bb_idx: usize, span: Span, is_fncall: bool, )

Source

pub fn rate_confidence(kind: ValueKind, fully_dropped: bool) -> usize

Source

pub fn df_check( &mut self, value_idx: usize, bb_idx: usize, span: Span, flag_cleanup: bool, ) -> bool

Source

pub fn dp_check(&mut self, flag_cleanup: bool)

Source

fn dp_check_arg(&mut self, arg_idx: usize, flag_cleanup: bool)

Trait Implementations§

Source§

impl<'tcx> Display for SafeDropGraph<'tcx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tcx> Freeze for SafeDropGraph<'tcx>

§

impl<'tcx> !RefUnwindSafe for SafeDropGraph<'tcx>

§

impl<'tcx> !Send for SafeDropGraph<'tcx>

§

impl<'tcx> !Sync for SafeDropGraph<'tcx>

§

impl<'tcx> Unpin for SafeDropGraph<'tcx>

§

impl<'tcx> !UnwindSafe for SafeDropGraph<'tcx>

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,