[clang][dataflow] Fix `Environment::join`'s handling of flow-condition merging.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 14 Apr 2022 13:42:02 +0000 (13:42 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Mon, 25 Apr 2022 15:05:50 +0000 (15:05 +0000)
commit37b4782e3e53cba265d26843f222134ed21e1974
tree5d0f5902384191935e35f2269d0629f611989b2a
parent5db925023169f8a19419e68153682d1e518f8392
[clang][dataflow] Fix `Environment::join`'s handling of flow-condition merging.

The current implementation mutates the environment as it performs the
join. However, that interferes with the call to the model's `merge` operation,
which can modify `MergedEnv`. Since any modifications are assumed to apply to
the post-join environment, providing the same environment for both is
incorrect. This mismatch is a particular concern for joining the flow
conditions, where modifications in the old environment may not be propagated to
the new one.

Differential Revision: https://reviews.llvm.org/D124104
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp