pub struct FuncPAGBuilder<'pta, 'tcx, 'compilation> { /* private fields */ }
Expand description

A visitor that traverses the MIR associated with a particular function’s body and build the function’s pointer assignment graph.

Implementations§

source§

impl<'pta, 'tcx, 'compilation> FuncPAGBuilder<'pta, 'tcx, 'compilation>

source

pub fn new( acx: &'pta mut AnalysisContext<'tcx, 'compilation>, func_id: FuncId, mir: &'tcx Body<'tcx>, fpag: &'pta mut FuncPAG ) -> FuncPAGBuilder<'pta, 'tcx, 'compilation>

source

pub fn build(&mut self)

Builds the PAG.

source

pub fn visit_body(&mut self)

source

pub fn inline_indirectly_called_function( &mut self, callee_def_id: &DefId, gen_args: &GenericArgsRef<'tcx>, args: Vec<Rc<Path>>, destination: Rc<Path>, location: Location )

Fn::call, FnMut::call_mut, FnOnce::call_once all receive two arguments:

  1. An operand of any type that implements Fn|FnMut|FnOnce, including function items, function pointers and closures.
  2. A tuple of argument values for the call. The tuple is unpacked and the callee is then invoked with its normal function signature. In the case of calling a closure, the closure is included as the first argument.

All of this happens in code that is not encoded as MIR, so we need built in support for it.

source

pub fn add_internal_edges( &mut self, src_path: Rc<Path>, src_type: Ty<'tcx>, dst_path: Rc<Path>, dst_type: Ty<'tcx> )

If the source path and the destination path are both of pointer types, add a direct edge between them. Otherwise, get their pointer type fields if exist and add internal edges between these fields.

source

pub fn create_aux_local(&mut self, ty: Ty<'tcx>) -> Rc<Path>

Creates an auxiliary local variable with the given type.

source

pub fn get_param_env(&self) -> ParamEnv<'tcx>

Returns the parameter environment for the current function.

source

pub fn copy_and_transmute( &mut self, source_path: Rc<Path>, source_rustc_type: Ty<'tcx>, target_path: Rc<Path>, target_rustc_type: Ty<'tcx> )

Copy the value at source_path to a value at target_path. If the type of source_path is different from that at target_path, the value is transmuted.

source

pub fn add_addr_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

source

pub fn add_direct_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

source

pub fn add_store_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

Adds a store edge from src to dst. Given a store statement (*p).f1.f2...fn = q, a store edge of format q --STORE(f1.f2...fn)--> p is added.

source

pub fn add_load_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

Adds a load edge from src to dst. Given a load statement p = (*q).f1.f2...fn, a Load edge q --LOAD(f1.f2...fn)--> p is added.

source

pub fn add_gep_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

Adds a gep edge from src to dst. Given a gep statement p = &((*q).f1.f2...fn), a gep edge q --GEP(f1.f2...fn)--> p is added.

source

pub fn add_cast_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

source

pub fn add_offset_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)

source

pub fn add_edge(&mut self, src: Rc<Path>, dst: Rc<Path>, kind: PAGEdgeEnum)

Adds an internal edge from src to dst of kind to the function pag.

Trait Implementations§

source§

impl<'pta, 'tcx, 'compilation> Debug for FuncPAGBuilder<'pta, 'tcx, 'compilation>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'pta, 'tcx, 'compilation> !RefUnwindSafe for FuncPAGBuilder<'pta, 'tcx, 'compilation>

§

impl<'pta, 'tcx, 'compilation> !Send for FuncPAGBuilder<'pta, 'tcx, 'compilation>

§

impl<'pta, 'tcx, 'compilation> !Sync for FuncPAGBuilder<'pta, 'tcx, 'compilation>

§

impl<'pta, 'tcx, 'compilation> Unpin for FuncPAGBuilder<'pta, 'tcx, 'compilation>

§

impl<'pta, 'tcx, 'compilation> !UnwindSafe for FuncPAGBuilder<'pta, 'tcx, 'compilation>

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.