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

Method intraproc_alias

src/analysis/pointsto/mod.rs:866–884  ·  view source on GitHub ↗

Check alias of p1 and p2 if they are from the same fn. if pts(p1) intersect pts(p2) != empty then they probably alias else unlikely

(
        &mut self,
        instance: &Instance<'tcx>,
        node1: &ConstraintNode<'tcx>,
        node2: &ConstraintNode<'tcx>,
    )

Source from the content-addressed store, hash-verified

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
866 fn intraproc_alias(
867 &mut self,
868 instance: &Instance<'tcx>,
869 node1: &ConstraintNode<'tcx>,
870 node2: &ConstraintNode<'tcx>,
871 ) -> Option<ApproximateAliasKind> {
872 let body = self.tcx.instance_mir(instance.def);
873 let points_to_map = self.get_or_insert_pts(instance.def_id(), body).clone();
874 let pts1 = points_to_map.get(node1)?.clone();
875 let pts2 = points_to_map.get(node2)?.clone();
876 if pts1.intersection(&pts2).next().is_some() {
877 return Some(ApproximateAliasKind::Probably);
878 }
879 if point_to_same_projected_alias(&pts1, &pts2, &points_to_map, body, self.tcx) {
880 Some(ApproximateAliasKind::Possibly)
881 } else {
882 Some(ApproximateAliasKind::Unlikely)
883 }
884 }
885
886 /// Check if `pointer` points-to `pointee` in the same function.
887 fn intraproc_points_to(

Callers 3

aliasMethod · 0.80
intra_points_toMethod · 0.80
interproc_aliasMethod · 0.80

Calls 2

get_or_insert_ptsMethod · 0.80
nextMethod · 0.80

Tested by

no test coverage detected