[PATCH] D129755: Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 12:35:25 PDT 2022


aaronpuchert added a comment.

In D129755#3865342 <https://reviews.llvm.org/D129755#3865342>, @rupprecht wrote:

> I'm seeing a fair number of breakages from this patch (not really sure how many we truly have, I've hit ~5-10 so far in widely used libraries, but I suspect we have far more in the long tail).

That might be an argument to move up our release note to "Potentially breaking changes", but we can also decide that around the next release.

> How invasive/annoying would it be to carve out a subwarning for this category of bugs and call it something like `-Wthread-safety-elision`?

Are you seeing warnings because of the different treatment of copy-elided construction, or because we've started to consider `CXXConstructorCall`s outside of the initializer of a `DeclStmt`? In any event, this change is quite fundamental and doesn't make it easy to selectively switch back to the old behavior:

- For copy elision we'd need to stop adding the scoped capability in `BuildLockset::handleCall`, then in `BuildLockset::VisitDeclStmt` add back in the code building the fake constructor call. Then there might be inconsistencies.
- If it's the additional constructor calls, we'd have to change `BuildLockset::VisitCXXConstructExpr` and `BuildLockset::VisitDeclStmt` so that we continue to only consider some constructor calls. This would be easier, but would result in a rather odd warning flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129755



More information about the cfe-commits mailing list