[PATCH] D82598: [analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn't exist

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 09:08:36 PDT 2020


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





More information about the cfe-commits mailing list