[PATCH] D41933: handle scoped_lockable objects being returned by value in C++17

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 11:13:39 PST 2018


aaron.ballman added a comment.

I think this approach is a reasonable approximation, but @delesley has the final word.



================
Comment at: lib/Analysis/ThreadSafety.cpp:1994
 
+static CXXConstructorDecl *findConstructorForByValueReturn(CXXRecordDecl *RD) {
+  // Prefer a move constructor over a copy constructor. If there's more than
----------------
Can you sprinkle some const correctness around this declaration?


================
Comment at: lib/Analysis/ThreadSafety.cpp:2001
+  for (CXXConstructorDecl *Ctor : RD->ctors()) {
+    if (Ctor->isDeleted() || Ctor->getAccess() != AS_public)
+      continue;
----------------
Should we care about access checking here (protected ctor within a reasonable context, or friendship)?


Repository:
  rC Clang

https://reviews.llvm.org/D41933





More information about the cfe-commits mailing list