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>)
| 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 |
no test coverage detected