[PATCH] Add a clang-tidy check for move constructors/assignment ops without noexcept.

Manuel Klimek klimek at google.com
Fri May 22 03:29:46 PDT 2015


lg


================
Comment at: clang-tidy/misc/NoexceptMoveCtorsCheck.cpp:28-35
@@ +27,10 @@
+  if (const auto *Decl = Result.Nodes.getNodeAs<CXXMethodDecl>("decl")) {
+    StringRef MethodType = "assignment operator";
+    if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(Decl)) {
+      if (!Ctor->isMoveConstructor())
+        return;
+      MethodType = "constructor";
+    } else if (!Decl->isMoveAssignmentOperator()) {
+      return;
+    }
+
----------------
I think we should add matchers to make it possible to express this (not necessary for this patch though).

http://reviews.llvm.org/D9933

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list