[clang] [CIR] Implement isMemcpyEquivalentSpecialMember for trivial copy/move ctors (PR #186700)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 15 19:42:49 PDT 2026


================
@@ -1278,25 +1278,55 @@ mlir::Value CIRGenFunction::getVTablePtr(mlir::Location loc, Address thisAddr,
   return vtable;
 }
 
+// TODO(CIR): This is duplicated from CGClass.cpp. Share between OG and CIR.
+static bool isMemcpyEquivalentSpecialMember(CIRGenModule &cgm,
+                                            const CXXMethodDecl *d) {
+  auto *cd = dyn_cast<CXXConstructorDecl>(d);
+  if (!(cd && cd->isCopyOrMoveConstructor()) &&
----------------
erichkeane wrote:

oof.... this 'if' is pretty ugly.  can we do something to make it clearer?  I would actually prefer we extract the `isCopyOrMoveConstructor` to `CXXMethodDecl` (perhaps as well?).

https://github.com/llvm/llvm-project/pull/186700


More information about the cfe-commits mailing list