================ @@ -15978,6 +15988,24 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, CheckCoroutineWrapper(FD); } + // Diagnose invalid SYCL kernel entry point function declarations. + if (FD && !FD->isInvalidDecl() && !FD->isTemplated() && + FD->hasAttr<SYCLKernelEntryPointAttr>()) { + if (FD->isDeleted()) { + Diag(FD->getAttr<SYCLKernelEntryPointAttr>()->getLocation(), + diag::err_sycl_entry_point_invalid) + << /*deleted function*/ 2; + } else if (FD->isDefaulted()) { + Diag(FD->getAttr<SYCLKernelEntryPointAttr>()->getLocation(), + diag::err_sycl_entry_point_invalid) + << /*defaulted function*/ 3; + } else if (FSI->isCoroutine()) { + Diag(FD->getAttr<SYCLKernelEntryPointAttr>()->getLocation(), + diag::err_sycl_entry_point_invalid) + << /*coroutine*/ 7; ---------------- erichkeane wrote:
Yes, there isn't a convenient way of doing so in the diagnostics engine unfortunately. I'd love for us to have that! But typically we just define it elsewhere. For large lists like this it can make it significantly more readable, and much less likely to not be updated because of a copy/paste error (which happens OFTEN). See `AttributeArgumentNType` and `AttributeDeclKind` for some examples, but they are kind of sprinkled in quite a few places, Richard had me do some a few times IIRC for function multiversioning. `Sema::checkTargetVersionAttr` has some more local versions of it. https://github.com/llvm/llvm-project/pull/120327 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits