paralegal_flow::ana

Struct SPDGGenerator

Source
pub struct SPDGGenerator<'tcx> {
    pub opts: &'static Args,
    pub tcx: TyCtxt<'tcx>,
    stats: Stats,
    pdg_constructor: MemoPdgConstructor<'tcx>,
    judge: Rc<InlineJudge<'tcx>>,
}
Expand description

Read-only database of information the analysis needs.

Self::analyze serves as the main entrypoint to SPDG generation.

Fields§

§opts: &'static Args§tcx: TyCtxt<'tcx>§stats: Stats§pdg_constructor: MemoPdgConstructor<'tcx>§judge: Rc<InlineJudge<'tcx>>

Implementations§

Source§

impl<'tcx> SPDGGenerator<'tcx>

Source

pub fn new( inline_judge: InlineJudge<'tcx>, opts: &'static Args, tcx: TyCtxt<'tcx>, body_cache: Rc<BodyCache<'tcx>>, stats: Stats, ) -> Self

Source

pub fn marker_ctx(&self) -> &MarkerCtx<'tcx>

Source

fn handle_target( &mut self, target: &FnToAnalyze, known_def_ids: &mut impl Extend<DefId>, ) -> Result<(Endpoint, SPDG)>

Perform the analysis for one #[paralegal_flow::analyze] annotated function and return the representation suitable for emitting into Forge.

Main work for a single target is performed by GraphConverter.

Source

pub fn analyze( &mut self, targets: Vec<FnToAnalyze>, ) -> Result<(ProgramDescription, AnalyzerStats)>

Main analysis driver. Essentially just calls Self::handle_target once for every function in self.functions_to_analyze after doing some other setup necessary for the flow graph creation.

Should only be called after the visit.

Source

fn make_program_description( &self, controllers: HashMap<Endpoint, SPDG>, known_def_ids: HashSet<DefId>, _targets: &[FnToAnalyze], ) -> (ProgramDescription, AnalyzerStats)

Given the PDGs and a record of all DefIds we’ve seen, compile auxillary information the policies will need into the artifact to be emitted.

Source

fn collect_stats_and_analyzed_spans(&self) -> (AnalyzerStats, AnalyzedSpans)

Source

fn get_prior_stats(&self) -> DumpStats

Source

fn collect_instruction_info( &self, controllers: &HashMap<Endpoint, SPDG>, ) -> HashMap<GlobalLocation, InstructionInfo>

Create an InstructionInfo record for each GlobalLocation mentioned in the controllers.

Source

fn collect_type_info(&self) -> TypeInfoMap

Create a TypeDescription record for each marked type that as mentioned in the PDG.

Auto Trait Implementations§

§

impl<'tcx> Freeze for SPDGGenerator<'tcx>

§

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

§

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

§

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

§

impl<'tcx> Unpin for SPDGGenerator<'tcx>

§

impl<'tcx> !UnwindSafe for SPDGGenerator<'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, 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.
Source§

impl<T> Captures<'_> for T
where T: ?Sized,