[clang] [CIR] cir.call with scalar return type (PR #135552)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 15 14:10:34 PDT 2025
================
@@ -18,9 +18,12 @@
using namespace clang;
using namespace clang::CIRGen;
-CIRGenFunctionInfo *CIRGenFunctionInfo::create() {
- // For now we just create an empty CIRGenFunctionInfo.
- CIRGenFunctionInfo *fi = new CIRGenFunctionInfo();
+CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType) {
+ void *buffer = operator new(totalSizeToAlloc<ArgInfo>(1));
----------------
erichkeane wrote:
At least in the frontend we typically use the allocator built into ASTContext (so you'll see `= new (ASTContext, size, alloc)`), so it is just weird to be using the typeless version of `operator new` (and in fact, in llvm I only see 3-4 uses of this pattern).
My biggest concern is that MLIR seems to use `malloc` and this uses `operator new`, which aren't necessarily going to have compatible deallocation, though I guess this isn't intended to co-lifetime that one.
HOWEVER, also of importance: where is the corresponding 'delete'?
I realize I'm asking questions that are problematic in the current CodeGen, but ones I'd like to see if we can get right here.
https://github.com/llvm/llvm-project/pull/135552
More information about the cfe-commits
mailing list