Skip to main content

nyx_scanner/pointer/
mod.rs

1//! Field-sensitive Steensgaard alias / points-to analysis.
2//!
3//! Sibling to [`crate::ssa::heap`]: where heap tracks per-value
4//! container identity for element abstractions, this module tracks
5//! field-sensitive points-to so the engine can distinguish a receiver
6//! from a sub-field. `c.mu.Lock()` acquires on `Field(c, mu)`, not `c`,
7//! so the resource-lifecycle pass doesn't mis-attribute the acquire.
8//! Cross-method field flow (method A writes `this.cache`, method B
9//! reads it) observes the shared `Field(SelfParam, cache)` location.
10
11pub mod analysis;
12pub mod domain;
13
14pub use analysis::{
15    PointsToFacts, analyse_body, extract_field_points_to, is_container_read_callee_pub,
16    is_container_write_callee,
17};
18pub use domain::{AbsLoc, LocId, LocInterner, PointsToSet, PtrProxyHint};
19
20/// Returns whether the field-sensitive pointer analysis is enabled.
21/// Set `NYX_POINTER_ANALYSIS=0` (or `false`) to disable.
22#[inline]
23pub fn is_enabled() -> bool {
24    !matches!(
25        std::env::var("NYX_POINTER_ANALYSIS").ok().as_deref(),
26        Some("0") | Some("false") | Some("FALSE")
27    )
28}