[clang] [clang-tools-extra] [llvm] [clang] Simplify device kernel attributes (PR #137882)

Nick Sarnie via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 07:14:39 PDT 2025


================
@@ -3541,7 +3541,7 @@ bool FunctionDecl::isExternC() const {
 }
 
 bool FunctionDecl::isInExternCContext() const {
-  if (hasAttr<OpenCLKernelAttr>())
+  if (hasAttr<DeviceKernelAttr>() && getASTContext().getLangOpts().OpenCL)
----------------
sarnex wrote:

Thanks for the review. In an ideal world we would just be able to use the fact it's been specified as a device kernel do to the checks but right now it's not that simple, one case is the multiple language like you mentioned. I tried OpenCL + SYCL and that worked, so there is some ambiguity there.

Let me update these checks to use the spelling just to simplify this change. Thanks again.

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


More information about the llvm-commits mailing list