================
@@ -170,7 +170,7 @@ class TransferVisitor : public 
ConstStmtVisitor<TransferVisitor> {
 
       auto *RHSVal = Env.getValue(*RHS);
       if (RHSVal == nullptr)
-        break;
+        RHSVal = Env.createValue(LHS->getType());
----------------
ymand wrote:

> I haven't quite figured out what exactly does a null value represents. Is it, 
> like, "unimplemented"? If yes, creating a new value is probably better.

Sorry -- we really should have a dev guide for Clang Dataflow. Yes, it 
represents "unmodeled". It's an incomplete part of the system, which can have 
assorted causes. Our general approach is to on-demand create values in these 
cases (that is, wait until a point where have a fresh/blank value will be 
useful), but I don't believe we have a hard and fast rule. But, as your test 
demonstrates, the current behavior is definitely wrong. 

I'm somewhat inclined towards your choice, because it means that we'll have 
consistent reasoning is this simple case:

```
      Foo = unknown();
      int FooAtB = Foo;

      if (cond()) {
         // something involving FooAtB 
      } else {
         // something else involving FooAtB 
      }
```
With your current approach, a fresh value is populated and the branches will 
consider the same fresh value. otherwise, anything that on-demand introduces 
the value used by FooAtB, will result in separate copies for the two branches.

https://github.com/llvm/llvm-project/pull/178943
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to