https://github.com/sarnex created https://github.com/llvm/llvm-project/pull/143546
I didn't add a test because this can't be reproduced yet in this repo, I reproduced this only in intel's fork with more SYCL support. I also fixed some formatting. >From b5c115df82873ecd092d86be3e7e8339e076981f Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Tue, 10 Jun 2025 07:58:05 -0700 Subject: [PATCH] [Clang][Attr] Fix possible crash when trying to check for DeviceKernelAttr spelling Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/include/clang/Basic/Attr.td | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index f889e41c8699f..82861a3d618d9 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1590,11 +1590,11 @@ def DeviceKernel : DeclOrTypeAttr { // list, but here we have the same spelling with unscores and without, // so handle that case manually. return A.getAttributeSpellingListIndex() == Keyword_kernel || - A.getAttrName()->getName() == "kernel"; + (A.getAttrName() && A.getAttrName()->getName() == "kernel"); } static inline bool isOpenCLSpelling(const AttributeCommonInfo* A) { - if (!A) return false; - return isOpenCLSpelling(*A); + if (!A) return false; + return isOpenCLSpelling(*A); } }]; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits