[PATCH] D20170: [clang-tidy] TypeTraits - Type is not expensive to copy when it has a deleted copy constructor.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 07:32:58 PDT 2016


aaron.ballman added inline comments.

================
Comment at: clang-tidy/utils/TypeTraits.cpp:31
@@ +30,3 @@
+
+bool hasDeletedCopyConstructor(QualType Type, ASTContext &Context) {
+  auto *Record = Type->getAsCXXRecordDecl();
----------------
No need to pass in `Context` any longer.

================
Comment at: clang-tidy/utils/TypeTraits.cpp:33
@@ +32,3 @@
+  auto *Record = Type->getAsCXXRecordDecl();
+  if (!Record || !Record->hasDefinition())
+    return false;
----------------
Should be no codegen difference in practice; it's just conciseness.

================
Comment at: clang-tidy/utils/TypeTraits.cpp:35
@@ +34,3 @@
+    return false;
+  for (const CXXConstructorDecl *Constructor : Record->ctors()) {
+    if (Constructor->isCopyConstructor() && Constructor->isDeleted())
----------------
Can just use `const auto *` for this, but I'm fine either way.


http://reviews.llvm.org/D20170





More information about the cfe-commits mailing list