[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 8 05:30:43 PDT 2025
================
@@ -157,10 +157,18 @@ class Environment {
};
/// Creates an environment that uses `DACtx` to store objects that encompass
- /// the state of a program.
+ /// the state of a program. `FlowConditionToken` sets the flow condition
+ /// associated with the environment. Generally, new environments should be
+ /// initialized with a fresh token, by using one of the other
+ /// constructors. This constructor is for specialized use, including
+ /// deserialization and delegation from other constructors.
+ Environment(DataflowAnalysisContext &DACtx, Atom FlowConditionToken)
----------------
ymand wrote:
The problem is that the exact serialization choice is up to clients -- there isn't one facility, like there is for Formula. The motivating example is Nullability inference, where we'll be serializing to custom protobufs. So, I don't think that C++'s encapsulation mechanism is a good fit here.
I'm open to alternative designs -- e.g. should we consider defining a protobuf message here, etc.
https://github.com/llvm/llvm-project/pull/152487
More information about the cfe-commits
mailing list