[PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 06:46:23 PDT 2015


alexfh added a comment.

Sorry for the long delay.


================
Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:40
@@ +39,3 @@
+  for (const auto *Ctor : CopyCtor->getParent()->ctors()) {
+    if (Ctor->isMoveConstructor() &&
+        Ctor->getAccess() <= AS_protected &&
----------------
clang-format?

================
Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:46
@@ +45,3 @@
+      //
+      // FIXME: Determine whether the move constructor is a viable candidate
+      // for the ctor-initializer, perhaps provide a fixit that suggests
----------------
This seems to be rather important to do from the beginning. Otherwise the check may be too noisy. BTW, did you run it over LLVM and Clang sources? Would be useful for some smoke testing.

================
Comment at: test/clang-tidy/misc-move-constructor-init.cpp:64
@@ +63,3 @@
+struct J : I {
+  // CHECK-NOT: warning:
+  J(J &&RHS) : I(RHS) {} // ok
----------------
I'd suggest using FileCheck -implicit-check-not='{{warning|error}}:' instead of stuffing the code with `// CHECK-NOT: warning:`. It will make the test more consistent with the other tests that use the clang_tidy_test.sh script.


http://reviews.llvm.org/D11784





More information about the cfe-commits mailing list