[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

Felix Berger via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 08:44:42 PDT 2016

flx created this revision.
flx added a reviewer: alexfh.
flx added a subscriber: cfe-commits.
flx set the repository for this revision to rL LLVM.

IsExpensiveToCopy can return false positives for incomplete types, so ignore them.

All existing ClangTidy tests that depend on this function still pass as the types are complete.




Index: clang-tidy/utils/TypeTraits.cpp
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 llvm::Optional<bool> isExpensiveToCopy(QualType Type,
                                        const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
     return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
          !classHasTrivialCopyAndDestroy(Type) &&

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26195.76563.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161101/9fa20363/attachment.bin>

More information about the cfe-commits mailing list