================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to