MCPcopy Create free account
hub / github.com/CodeSentryAI/lockbud / get_or_insert_pts

Method get_or_insert_pts

src/analysis/pointsto/mod.rs:853–862  ·  view source on GitHub ↗

Get the points-to info from cache `pts`. If not exists, then perform points-to analysis and add the obtained points-to info to cache.

(&mut self, def_id: DefId, body: &Body<'tcx>)

Source from the content-addressed store, hash-verified

851 /// If not exists, then perform points-to analysis
852 /// and add the obtained points-to info to cache.
853 pub fn get_or_insert_pts(&mut self, def_id: DefId, body: &Body<'tcx>) -> &PointsToMap<'tcx> {
854 if self.pts.contains_key(&def_id) {
855 self.pts.get(&def_id).unwrap()
856 } else {
857 let mut pointer_analysis = Andersen::new(body, self.tcx);
858 pointer_analysis.analyze();
859 let pts = pointer_analysis.finish();
860 self.pts.entry(def_id).or_insert(pts)
861 }
862 }
863
864 /// Check alias of p1 and p2 if they are from the same fn.
865 /// if pts(p1) intersect pts(p2) != empty then they probably alias else unlikely

Callers 6

intra_points_toMethod · 0.80
inter_points_toMethod · 0.80
intraproc_aliasMethod · 0.80
intraproc_points_toMethod · 0.80
interproc_aliasMethod · 0.80
detect_instanceMethod · 0.80

Calls 2

analyzeMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected