[PATCH] D126534: [analyzer] Deadstore static analysis: Fix false positive on C++17 assignments

Fred Tingaud via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 06:27:38 PDT 2022


frederic-tingaud-sonarsource added a comment.

Thanks @NoQ!

The change in behavior is indeed what I was mentioning in the summary. After discussing it with a colleague, it seemed to us that pointing to a more precise range where the object is allocated was an improvement. I understand your point about pointing at something that is nearer to the assignment, but in that case, wouldn't it make sense to point at the whole assignment?

  id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning{{never read}}
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We already detect the presence of a constructor, but to skip the report altogether as constructors could have undetected side effects.


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

https://reviews.llvm.org/D126534



More information about the cfe-commits mailing list