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>
impl<'tcx> SPDGGenerator<'tcx>
pub fn new( inline_judge: InlineJudge<'tcx>, opts: &'static Args, tcx: TyCtxt<'tcx>, body_cache: Rc<BodyCache<'tcx>>, stats: Stats, ) -> Self
pub fn marker_ctx(&self) -> &MarkerCtx<'tcx>
Sourcefn handle_target(
&mut self,
target: &FnToAnalyze,
known_def_ids: &mut impl Extend<DefId>,
) -> Result<(Endpoint, SPDG)>
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
.
Sourcepub fn analyze(
&mut self,
targets: Vec<FnToAnalyze>,
) -> Result<(ProgramDescription, AnalyzerStats)>
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.
Sourcefn make_program_description(
&self,
controllers: HashMap<Endpoint, SPDG>,
known_def_ids: HashSet<DefId>,
_targets: &[FnToAnalyze],
) -> (ProgramDescription, AnalyzerStats)
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 DefId
s we’ve seen, compile
auxillary information the policies will need into the artifact to be
emitted.
fn collect_stats_and_analyzed_spans(&self) -> (AnalyzerStats, AnalyzedSpans)
fn get_prior_stats(&self) -> DumpStats
Sourcefn collect_instruction_info(
&self,
controllers: &HashMap<Endpoint, SPDG>,
) -> HashMap<GlobalLocation, InstructionInfo>
fn collect_instruction_info( &self, controllers: &HashMap<Endpoint, SPDG>, ) -> HashMap<GlobalLocation, InstructionInfo>
Create an InstructionInfo
record for each GlobalLocation
mentioned in the controllers.
Sourcefn collect_type_info(&self) -> TypeInfoMap
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> 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
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>
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>
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