@@ -467,18 +467,18 @@ class LLVMEmitter {
467467 // Implement prox_rt_resume wrapper
468468 llvm::BasicBlock* Entry = llvm::BasicBlock::Create (*Context, " entry" , FResume);
469469 llvm::IRBuilder<> ResBuilder (Entry);
470- llvm::Function* FCoroResume = llvm::Intrinsic::getDeclaration (ModuleOb. get (), llvm::Intrinsic::coro_resume);
471- // Note: getDeclaration is deprecated but for some LLVM versions getOrInsertDeclaration is for non-intrinsics?
472- // Actually, for intrinsics, getDeclaration is still standard in many versions.
473- // But the warning says use getOrInsertDeclaration?
474- // Wait, Intrinsic::getDeclaration returns Function*.
475- // getOrInsertDeclaration returns FunctionCallee.
476- // Let's stick to getDeclaration for now if it works, or suppress warning.
477- // If compilation failed with error, we change. It was a WARNING.
478- // I will keep it as is, or suppress warning if strict.
479- // User asked to fix ERRORS. This is a warning.
480- // But let's try to update if possible.
481- // llvm::Function* FCoroResume = llvm::Intrinsic::getDeclaration(ModuleOb.get(), llvm::Intrinsic::coro_resume);
470+
471+ // Declare llvm.coro.resume manually instead of Intrinsic::getDeclaration for LLVM 15+ compatibility
472+ llvm::Function* FCoroResume = ModuleOb-> getFunction ( " llvm.coro.resume " );
473+ if (!FCoroResume) {
474+ llvm::FunctionType *CoroResumeType = llvm::FunctionType::get (
475+ Builder-> getVoidTy (),
476+ {Builder-> getPtrTy ()},
477+ false
478+ );
479+ FCoroResume = llvm::Function::Create (CoroResumeType, llvm::Function::ExternalLinkage, " llvm.coro.resume " , ModuleOb. get ());
480+ }
481+
482482 ResBuilder.CreateCall (FCoroResume, {FResume->arg_begin ()});
483483 ResBuilder.CreateRetVoid ();
484484
0 commit comments