[clang] [CIR] cir.call with scalar return type (PR #135552)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 16:42:47 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:

> I couldn't find any instances of ASTContext::Allocate being used in the classic codegen. Is it safe to use it here?

THAT I'm not sure of.  I was hoping that pinging the codegen codeowners would bring us some clarity :)

That being `delete` instead of `operator delete` (or just `new` here...) don't necessarily match.

That said, I'd probably push for a range-for implementation of that, else it would sound good to me.  It sounds like someone in the incubator noticed this at one point :):

```
for (CIRGenFuncInfo *FI : FunctionInfos) {
  delete FI;
  }
  ```

THOUGH Playing with it, I realize that there is some problem with the implementation of FoldingSetIterator that makes that not work right... perhaps someone needs to fix THAT too :D 

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


More information about the cfe-commits mailing list