[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
Tue Jun 7 05:45:05 PDT 2022


frederic-tingaud-sonarsource added a comment.

It might also be interesting to think about cases that went through transitive assignment stripping when talking about the diagnostic position:
Before my patch, a dead store on variable `a` was displayed as follows:

  B b;
  A a = static_cast<A>(b = createB());
                           ^~~~~~~~~ 

(I'm switching back to C++ because I'm not sure exactly how legal such a thing would be in objective-C).
With the current fix, that doesn't change.
It might be clearer for the user to either put the diagnostic on the whole assignment or at least the whole initialization.


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

https://reviews.llvm.org/D126534



More information about the cfe-commits mailing list