================
@@ -585,12 +585,20 @@ static void EmitBaseInitializer(CodeGenFunction &CGF,
isBaseVirtual);
}
-static bool isMemcpyEquivalentSpecialMember(const CXXMethodDecl *D) {
+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.
+ if (!CGM.getContext().arePFPFieldsTriviallyCopyable(D->getParent()) &&
+ CGM.getContext().hasPFPFields(
+ CGM.getContext().getCanonicalTagType(D->getParent())))
----------------
ojhunt wrote:
```suggestion
ASTContext &Ctx = CGM.getContext(); // The rest of the function should be
updated to use this but not in this PR
CXXRecordDecl *Parent = D->getParent();
WhateverTheTypeIs *CanonicalParentType =
Ctx.getCanonicalTagType(Parent);
if (!Ctx.arePFPFieldsTriviallyCopyable(Parent) &&
Ctx.hasPFPFields(CanonicalParentType))
```
https://github.com/llvm/llvm-project/pull/172119
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits