================
@@ -570,30 +570,8 @@ static void EmitBaseInitializer(CodeGenFunction &CGF,
isBaseVirtual);
}
-static bool isMemcpyEquivalentSpecialMember(CodeGenModule &CGM,
- const CXXMethodDecl *D) {
- auto *CD = dyn_cast<CXXConstructorDecl>(D);
- if (!(CD && CD->isCopyOrMoveConstructor()) &&
- !D->isCopyAssignmentOperator() && !D->isMoveAssignmentOperator())
- return false;
-
- // Non-trivially-copyable fields with pointer field protection need to be
- // copied one by one.
- ASTContext &Ctx = CGM.getContext();
- const CXXRecordDecl *Parent = D->getParent();
- if (!Ctx.arePFPFieldsTriviallyCopyable(Parent) &&
- Ctx.hasPFPFields(Ctx.getCanonicalTagType(Parent)))
- return false;
-
- // We can emit a memcpy for a trivial copy or move constructor/assignment.
- if (D->isTrivial() && !D->getParent()->mayInsertExtraPadding())
- return true;
-
- // We *must* emit a memcpy for a defaulted union copy or move op.
- if (D->getParent()->isUnion() && D->isDefaulted())
- return true;
-
- return false;
+static bool isMemcpyEquivalentSpecialMember(const CXXMethodDecl *D) {
+ return D->getASTContext().isMemcpyEquivalentSpecialMember(D);
----------------
erichkeane wrote:
putting this on `D` directly makes these much less necessary to copy.
https://github.com/llvm/llvm-project/pull/186700
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits