[clang] [CIR] Inheriting Constructor/inheriting ctor inlining lowering (PR #191467)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 06:14:49 PDT 2026


================
@@ -1344,14 +1344,134 @@ void CIRGenFunction::emitCXXConstructorCall(const clang::CXXConstructorDecl *d,
 
   assert(!cir::MissingFeatures::opCallArgEvaluationOrder());
 
-  emitCallArgs(args, fpt, e->arguments(), e->getConstructor(),
-               /*ParamsToSkip=*/0);
+  if (auto inherited = d->getInheritedConstructor();
+      !inherited || cgm.getTypes().inheritingCtorHasParams(inherited, type))
+    emitCallArgs(args, fpt, e->arguments(), e->getConstructor(),
+                 /*ParamsToSkip=*/0);
 
   assert(!cir::MissingFeatures::sanitizers());
   emitCXXConstructorCall(d, type, forVirtualBase, delegating, thisAddr, args,
                          e->getExprLoc());
 }
 
+static bool canEmitDelegateCallArgs(CIRGenModule &cgm, ASTContext &ctx,
+                                    const CXXConstructorDecl *d,
+                                    CXXCtorType type) {
+  // We can't forward a variadic call.
+  if (d->isVariadic())
+    return false;
+
+  if (ctx.getTargetInfo().getCXXABI().areArgsDestroyedLeftToRightInCallee()) {
----------------
erichkeane wrote:

I grabbed this logic from classic codegen, but didn't bother to spend much time looking into it.  I don't think this is actually used anywhere with our tests, so I am going to just remove the `parameters` check and update the NYI comment so we can come back to this another time.

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


More information about the cfe-commits mailing list