[clang] [CIR] Upstream support for operator assign (PR #145979)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 27 10:51:29 PDT 2025


================
@@ -258,6 +258,30 @@ void CIRGenFunction::emitDelegateCXXConstructorCall(
                          /*Delegating=*/true, thisAddr, delegateArgs, loc);
 }
 
+void CIRGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &args) {
+  const auto *assignOp = cast<CXXMethodDecl>(curGD.getDecl());
+  const Stmt *rootS = assignOp->getBody();
+  assert(isa<CompoundStmt>(rootS) &&
+         "Body of an implicit assignment operator should be compound stmt.");
+  const auto *rootCS = cast<CompoundStmt>(rootS);
+
+  // LexicalScope Scope(*this, RootCS->getSourceRange());
+  // FIXME(cir): add all of the below under a new scope.
----------------
andykaylor wrote:

It wasn't clear to me why a new scope would be needed here. Since this is emitting the body of the assignment operator, I think the scope will always be the same as the scope for the function, right?

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


More information about the cfe-commits mailing list