[clang] [clang] Fix device_kernel attribute crash on unsupported targets when not using AMDGPU spelling (PR #161687)

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 08:33:01 PDT 2025


================
@@ -5204,7 +5204,12 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
 static void handleDeviceKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
   bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
-  if (S.getLangOpts().SYCLIsDevice) {
+  if (!S.getLangOpts().OpenCL && !S.getLangOpts().CUDA &&
----------------
sarnex wrote:

I'm doing a test to see if we need the `AMDGPU` special casing, will post my results in the other PR. probably we should wait for that before moving forward with this

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


More information about the cfe-commits mailing list