[clang] [CIR] Emit CIR builtins: coroAlloc, coroBegin, and coroSize (PR #164180)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 24 11:04:03 PDT 2025
================
@@ -449,10 +449,16 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
}
case Builtin::BI__builtin_coro_free:
case Builtin::BI__builtin_coro_size: {
- cgm.errorNYI(e->getSourceRange(),
- "BI__builtin_coro_free, BI__builtin_coro_size NYI");
- assert(!cir::MissingFeatures::coroSizeBuiltinCall());
- return getUndefRValue(e->getType());
+ GlobalDecl gd{fd};
+ mlir::Type ty = cgm.getTypes().getFunctionType(
+ cgm.getTypes().arrangeGlobalDeclaration(gd));
+ const auto *nd = cast<NamedDecl>(gd.getDecl());
+ cir::FuncOp fnOp =
+ cgm.getOrCreateCIRFunction(nd->getName(), ty, gd, /*ForVTable=*/false,
+ /*DontDefer=*/false);
----------------
andykaylor wrote:
```suggestion
cgm.getOrCreateCIRFunction(nd->getName(), ty, gd, /*forVTable=*/false);
```
`dontDefer` defaults to false. Unless there is a reason to specifically show it here, it can be omitted. I'm not sure why `forVTable` doesn't also default to false. I don't think that's common. I only see one place in the incubator where it is called with true.
https://github.com/llvm/llvm-project/pull/164180
More information about the cfe-commits
mailing list