[clang] [CIR] Change previous coroutine builtins to have their own coro intrinsic ops (PR #211699)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 06:59:40 PDT 2026


================
@@ -42,13 +42,18 @@ struct clang::CIRGen::CGCoroData {
 
   // Stores the last emitted coro.free for the deallocate expressions, we use it
   // to wrap dealloc code with if(auto mem = coro.free) dealloc(mem).
-  cir::CallOp lastCoroFree = nullptr;
+  cir::CoroIntrinsicFreeOp lastCoroFree = nullptr;
 
   // A temporary bool alloca that stores whether 'await_resume' threw an
   // exception. If it did, 'true' is stored in this variable, and the coroutine
   // body must be skipped. If the promise type does not define an exception
   // handler, this is null.
   Address resumeEHVar = Address::invalid();
+  //
+  // If coro.id came from the builtin, remember the expression to give better
+  // diagnostic. If CoroIdExpr is nullptr, the coro.id was created by
+  // EmitCoroutineBody.
+  CallExpr const *coroIdExpr = nullptr;
----------------
erichkeane wrote:

Are you using this for anything other than its location? Could/should we just store that instead?  Perhaps as an optional.

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


More information about the cfe-commits mailing list