Set the null state of a PointerValue at a control flow join based on the nullability information from each incoming path.
PiperOrigin-RevId: 466890031
diff --git a/nullability_verification/pointer_nullability.h b/nullability_verification/pointer_nullability.h
index 96444b0..ab5fd68 100644
--- a/nullability_verification/pointer_nullability.h
+++ b/nullability_verification/pointer_nullability.h
@@ -22,14 +22,32 @@
std::pair<dataflow::AtomicBoolValue&, dataflow::AtomicBoolValue&>
getPointerNullState(const Expr* PointerExpr, const dataflow::Environment& Env);
+/// Returns the properties representing the nullness information of a pointer.
+///
+/// The first boolean indicates if the pointer's nullability is known.
+/// The second boolean indicates if the pointer's value is not null.
+std::pair<dataflow::AtomicBoolValue&, dataflow::AtomicBoolValue&>
+getPointerNullState(const dataflow::PointerValue& PointerVal,
+ const dataflow::Environment& Env);
+
/// Sets the nullness properties on the PointerValue assigned to `PointerExpr`
/// if not already initialised.
///
-/// The boolean properties may be constrained by passing in the BoolValues
-/// representing true or false to `KnownConstraint` and `NotNullConstraint`.
-/// Otherwise, the properties are set to freshly created atomic booleans.
+/// The boolean properties may be constrained by specifying `KnownConstraint`
+/// and `NotNullConstraint`. Otherwise, the properties are set to freshly
+/// created atomic booleans.
void initPointerNullState(const Expr* PointerExpr, dataflow::Environment& Env,
- dataflow::BoolValue* KnownConstraint,
+ dataflow::BoolValue* KnownConstraint = nullptr,
+ dataflow::BoolValue* NotNullConstraint = nullptr);
+
+/// Sets the nullness properties on `PointerVal` if not already initialised.
+///
+/// The boolean properties may be constrained by specifying `KnownConstraint`
+/// and `NotNullConstraint`. Otherwise, the properties are set to freshly
+/// created atomic booleans.
+void initPointerNullState(dataflow::PointerValue& PointerVal,
+ dataflow::Environment& Env,
+ dataflow::BoolValue* KnownConstraint = nullptr,
dataflow::BoolValue* NotNullConstraint = nullptr);
} // namespace nullability