[clang] [CIR] Upstream support for calling constructors (PR #143579)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 10 11:19:02 PDT 2025


================
@@ -141,6 +190,44 @@ arrangeFreeFunctionLikeCall(CIRGenTypes &cgt, CIRGenModule &cgm,
   return cgt.arrangeCIRFunctionInfo(retType, argTypes, required);
 }
 
+/// Arrange a call to a C++ method, passing the given arguments.
+///
+/// passProtoArgs indicates whether `args` has args for the parameters in the
+/// given CXXConstructorDecl.
+const CIRGenFunctionInfo &CIRGenTypes::arrangeCXXConstructorCall(
+    const CallArgList &args, const CXXConstructorDecl *d, CXXCtorType ctorKind,
+    bool passProtoArgs) {
+
+  // FIXME: Kill copy.
----------------
erichkeane wrote:

The only idea I have for us to do something like this, would be to have `arrangeCIRFunctionInfo` to have a optional `arg-transform` function.  So it becomes:

`arrangeCIRFunctionInfo(resultType, argTypes, [&](auto *arg) { astContext.getCanonicalParamType(arg.ty);});`

Alternatively, have it take some sort of mutating range, which does the work for us?  

Or maybe build that into CallArgList, and have `arrangeCIRFunctionInfo` take a `CallArgList` and use a `arg.getCanonicalParamType()` on CallArg's object.  WDYT?

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


More information about the cfe-commits mailing list