[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 05:41:34 PST 2024


================
@@ -105,6 +105,27 @@ class Environment {
       return true;
     }
 
+    /// Modifies `JoinedVal` to approximate both `Val1` and `Val2`. This should
+    /// obey the properties of a lattice join.
+    ///
+    /// `Env1` and `Env2` can be used to query child values and path condition
+    /// implications of `Val1` and `Val2` respectively.
+    ///
+    /// Requirements:
+    ///
+    ///  `Val1` and `Val2` must be distinct.
+    ///
+    ///  `Val1`, `Val2`, and `JoinedVal` must model values of type `Type`.
+    ///
+    ///  `Val1` and `Val2` must be assigned to the same storage location in
+    ///  `Env1` and `Env2` respectively.
+    virtual void join(QualType Type, const Value &Val1, const Environment &Env1,
+                      const Value &Val2, const Environment &Env2,
+                      Value &JoinedVal, Environment &JoinedEnv) {
+      assert(merge(Type, Val1, Env1, Val2, Env2, JoinedVal, JoinedEnv) &&
+             "dropping merged value is unsupported");
----------------
ymand wrote:

Whoops! Yes, indeed. Good catch, thanks!

https://github.com/llvm/llvm-project/pull/80361


More information about the cfe-commits mailing list