================
@@ -1538,11 +1533,44 @@ def CUDAShared : InheritableAttr {
 }
 def : MutualExclusions<[CUDAConstant, CUDAShared, HIPManaged]>;
 
-def SYCLKernel : InheritableAttr {
-  let Spellings = [Clang<"sycl_kernel">];
-  let Subjects = SubjectList<[FunctionTmpl]>;
-  let LangOpts = [SYCLDevice];
+def DeviceKernel : DeclOrTypeAttr {
+  let Spellings = [Clang<"device_kernel">, Clang<"sycl_kernel">,
+                   Clang<"nvptx_kernel">, Clang<"amdgpu_kernel">,
+                   CustomKeyword<"__kernel">, CustomKeyword<"kernel">];
+  let LangOpts = [];
   let Documentation = [SYCLKernelDocs];
+  let AdditionalMembers =
+  [{
+   inline bool isAMDGPUSpelling() const {
+     return isAMDGPUSpelling(*this);
+   }
+   template<typename T>
+   static inline bool isAMDGPUSpelling(const T& Attr) {
+     return Attr.getAttrName()->getName() == "amdgpu_kernel";
+   }
+   inline bool isNVPTXSpelling() const {
+     return isNVPTXSpelling(*this);
+   }
+   template<typename T>
+   static inline bool isNVPTXSpelling(const T& Attr) {
+     return Attr.getAttrName()->getName() == "nvptx_kernel";
+   }
+   inline bool isOpenCLSpelling() const {
+     return isOpenCLSpelling(*this);
+   }
+   template<typename T>
+   static inline bool isOpenCLSpelling(const T& Attr) {
+   return Attr.getAttrName()->getName() == "kernel" ||
----------------
erichkeane wrote:

Even without the `Accessors` thing that Aaron suggests, you can check the 
spelling-id vs the generated enums which is better than string compares.

https://github.com/llvm/llvm-project/pull/137882
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to