[PATCH] D31160: [clang-tidy] Fix misc-move-const-arg for move-only types.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 10:15:33 PDT 2017


alexfh added inline comments.


================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:76
   if (IsConstArg || IsTriviallyCopyable) {
+    if (const CXXRecordDecl *R = Arg->getType()->getAsCXXRecordDecl()) {
+      for (const auto *Ctor : R->ctors()) {
----------------
alexfh wrote:
> sbenza wrote:
> > Can we get this from R->hasTrivialCopyConstructor or R->hasNonTrivialCopyConstructor instead of iterating all constructors?
> Interesting idea, trying `R->hasTrivialCopyConstructor() || R->hasNonTrivialCopyConstructor()`.
I meant the opposite: `!R->hasTrivialCopyConstructor() && !R->hasNonTrivialCopyConstructor()`. But anyway it doesn't work. We could store another bit for deleted copy constructor, but it wouldn't worth it, if it's needed in this single case.


https://reviews.llvm.org/D31160





More information about the cfe-commits mailing list