[PATCH] D52443: Thread safety analysis: Examine constructor arguments

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 17:19:12 PDT 2018


aaronpuchert marked 2 inline comments as done.
aaronpuchert added a comment.

Since the (remaining) arguments are examined in a separate function, I thought I'd eliminate the boolean variables in `VisitCallExpr`. Apparently I prefer control flow over booleans, but if you disagree I can obviously change it back.



================
Comment at: lib/Analysis/ThreadSafety.cpp:2046
   const CXXConstructorDecl *D = Exp->getConstructor();
   if (D && D->isCopyConstructor()) {
     const Expr* Source = Exp->getArg(0);
----------------
delesley wrote:
> As a side note, we should probably special-case the move constructor too, with AK_Written.  That should be in a separate patch, though, and needs to be sequestered under -Wthread-safety-beta, which is complicated.   
I think your arguments from D52395 apply here as well: the move constructor does not necessarily write. Many simple types are trivially move constructible, and then the move constructor is effectively the same as the copy constructor.


Repository:
  rC Clang

https://reviews.llvm.org/D52443





More information about the cfe-commits mailing list