[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 2 00:48:07 PDT 2024


================
@@ -166,17 +166,20 @@ static Value *joinDistinctValues(QualType Type, Value &Val1,
   return JoinedVal;
 }
 
-// When widening does not change `Current`, return value will equal `&Prev`.
-static Value &widenDistinctValues(QualType Type, Value &Prev,
-                                  const Environment &PrevEnv, Value &Current,
-                                  Environment &CurrentEnv,
-                                  Environment::ValueModel &Model) {
+namespace {
+using WidenResult = Environment::ValueModel::WidenResult;
+}
+
+static WidenResult widenDistinctValues(QualType Type, Value &Prev,
----------------
martinboehme wrote:

```suggestion
static Environment::ValueModel::WidenResult widenDistinctValues(QualType Type, Value &Prev,
```

AFAICT, this is used exactly once. Maybe just spell it out?

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


More information about the cfe-commits mailing list