Skip to content

Commit aaec22f

Browse files
authored
[clang][dataflow] Remove deprecated ValueModel::merge() function. (#82602)
I'm not aware of any remaining overrides of this function. While I'm here, change an outdated comment in DataflowAnalysis.h that still referred to `merge()`. I've made the comment more general, referring simply to `ValueModel`, as we shouldn't really be repeating the documentation of that class here anyway.
1 parent 575bf33 commit aaec22f

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ namespace dataflow {
5454
/// Environment &Env)` - applies the analysis transfer
5555
/// function for a given edge from a CFG block of a conditional statement.
5656
///
57-
/// `Derived` can optionally override the following members:
58-
/// * `bool merge(QualType, const Value &, const Value &, Value &,
59-
/// Environment &)` - joins distinct values. This could be a strict
60-
/// lattice join or a more general widening operation.
57+
/// `Derived` can optionally override the virtual functions in the
58+
/// `Environment::ValueModel` interface (which is an indirect base class of
59+
/// this class).
6160
///
6261
/// `LatticeT` is a bounded join-semilattice that is used by `Derived` and must
6362
/// provide the following public members:

clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -79,32 +79,6 @@ class Environment {
7979
return ComparisonResult::Unknown;
8080
}
8181

82-
/// DEPRECATED. Override `join` and/or `widen`, instead.
83-
///
84-
/// Modifies `MergedVal` to approximate both `Val1` and `Val2`. This could
85-
/// be a strict lattice join or a more general widening operation.
86-
///
87-
/// If this function returns true, `MergedVal` will be assigned to a storage
88-
/// location of type `Type` in `MergedEnv`.
89-
///
90-
/// `Env1` and `Env2` can be used to query child values and path condition
91-
/// implications of `Val1` and `Val2` respectively.
92-
///
93-
/// Requirements:
94-
///
95-
/// `Val1` and `Val2` must be distinct.
96-
///
97-
/// `Val1`, `Val2`, and `MergedVal` must model values of type `Type`.
98-
///
99-
/// `Val1` and `Val2` must be assigned to the same storage location in
100-
/// `Env1` and `Env2` respectively.
101-
virtual bool merge(QualType Type, const Value &Val1,
102-
const Environment &Env1, const Value &Val2,
103-
const Environment &Env2, Value &MergedVal,
104-
Environment &MergedEnv) {
105-
return true;
106-
}
107-
10882
/// Modifies `JoinedVal` to approximate both `Val1` and `Val2`. This should
10983
/// obey the properties of a lattice join.
11084
///
@@ -121,11 +95,7 @@ class Environment {
12195
/// `Env1` and `Env2` respectively.
12296
virtual void join(QualType Type, const Value &Val1, const Environment &Env1,
12397
const Value &Val2, const Environment &Env2,
124-
Value &JoinedVal, Environment &JoinedEnv) {
125-
[[maybe_unused]] bool ShouldKeep =
126-
merge(Type, Val1, Env1, Val2, Env2, JoinedVal, JoinedEnv);
127-
assert(ShouldKeep && "dropping merged value is unsupported");
128-
}
98+
Value &JoinedVal, Environment &JoinedEnv) {}
12999

130100
/// This function may widen the current value -- replace it with an
131101
/// approximation that can reach a fixed point more quickly than iterated

0 commit comments

Comments
 (0)