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

Felix Berger via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 19:44:30 PDT 2016


flx added inline comments.

================
Comment at: clang-tidy/utils/TypeTraits.cpp:24
@@ -20,2 +23,3 @@
+
 bool classHasTrivialCopyAndDestroy(QualType Type) {
   auto *Record = Type->getAsCXXRecordDecl();
----------------
etienneb wrote:
> Should this be lifted to 'type_traits' ?
> 
> 
> The same function exists into clang-tidy/utils/TypeTraits.cpp
> ```
> namespace {
> bool classHasTrivialCopyAndDestroy(QualType Type) {
>   auto *Record = Type->getAsCXXRecordDecl();
>   return Record && Record->hasDefinition() &&
>          !Record->hasNonTrivialCopyConstructor() &&
>          !Record->hasNonTrivialDestructor();
> }
> } // namespace
> ```
> 
>  Alex, any toughs?
I'm not following. This is the same file.

================
Comment at: clang-tidy/utils/TypeTraits.cpp:31
@@ +30,3 @@
+
+bool hasDeletedCopyConstructor(QualType Type, ASTContext &Context) {
+  auto *Record = Type->getAsCXXRecordDecl();
----------------
etienneb wrote:
> aaron.ballman wrote:
> > No need to pass in `Context` any longer.
> ditto, to be lifted or not?
What do you mean with lifted? Exposed in the header file?

================
Comment at: clang-tidy/utils/TypeTraits.cpp:44
@@ -27,3 +43,3 @@
 
 llvm::Optional<bool> isExpensiveToCopy(QualType Type, ASTContext &Context) {
   if (Type->isDependentType())
----------------
etienneb wrote:
> nit: const ASTContext &Context
isTriviallyCopyablType below takes non-const ASTContext.


http://reviews.llvm.org/D20170





More information about the cfe-commits mailing list