xazax.hun added a comment.

In D82598#2162239 <https://reviews.llvm.org/D82598#2162239>, @Szelethus wrote:

> I chased my own tail for weeks before realizing that there is indeed another 
> instance when a live **statement** is stored, other then 
> `ObjCForCollectionStmt`...
>
>   void clang_analyzer_eval(bool);
>  
>   void test_lambda_refcapture() {
>     int a = 6;
>     [&](int &a) { a = 42; }(a);
>     clang_analyzer_eval(a == 42); // expected-warning{{TRUE}}
>   }
>


Hmm, interesting. I don't really understand why do we need to keep that block 
live, as we definitely won't use any of the value it provides (since it does 
not provide a value at all).

I am only doing guessing here, but maybe the side effect of the statement is 
pruned from the store as soon as it is no longer live?

I might be wrong here, but maybe solving this problem would not be the job of 
the liveness analysis but we have a bug elsewhere, as this binding should be 
pruned when `a` is a dead variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82598/new/

https://reviews.llvm.org/D82598



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to