[PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 05:24:33 PST 2015


alexfh added a comment.

Much better now. A few more comments.


================
Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:18
@@ +17,3 @@
+namespace {
+AST_MATCHER(CXXConstructorDecl, isNoThrowCopyConstructible) {
+  if (!Node.isCopyConstructor())
----------------
nit: I suggest changing `isNoThrowCopyConstructible` to `isNoThrowCopyConstructor`, because "constructible" is a trait of a class, not its constructor.

================
Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:22
@@ +21,3 @@
+
+  if (Node.isTrivial())
+    return true;
----------------
Out of curiosity: are we short-circuiting here for performance reasons or would the code below return `false` in this case?

================
Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:34
@@ +33,3 @@
+  }
+  return true;
+}
----------------
Is this `return` reachable? If yes, when exactly does this happen and is there a test for this case?


http://reviews.llvm.org/D14619





More information about the cfe-commits mailing list