[clang] [Clang][Attr] Fix possible crash when trying to check for DeviceKernel spelling (PR #143546)
Nick Sarnie via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 10 07:59:51 PDT 2025
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.sarnie at 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.sarnie at 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);
}
}];
}
More information about the cfe-commits
mailing list