[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 1 15:44:20 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");
----------------
gribozavr wrote:
```suggestion
bool ShouldKeep = merge(Type, Val1, Env1, Val2, Env2, JoinedVal, JoinedEnv);
assert(ShouldKeep && "dropping merged value is unsupported");
(void)ShouldKeep;
```
https://github.com/llvm/llvm-project/pull/80361
More information about the cfe-commits
mailing list