[clang] [SYCL] The sycl_kernel_entry_point attribute. (PR #111389)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 15 08:05:14 PDT 2024


================
@@ -198,3 +198,12 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr &AL) {
 
   handleSimpleAttribute<SYCLKernelAttr>(*this, D, AL);
 }
+
+void SemaSYCL::handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL) {
+  ParsedType PT = AL.getTypeArg();
+  TypeSourceInfo *TSI = nullptr;
+  (void)SemaRef.GetTypeFromParser(PT, &TSI);
+  assert(TSI && "no type source info for attribute argument");
----------------
tahonermann wrote:

The attribute parser should have already validated that there was a single argument that named a type. Error handling for non-type arguments is exercised by `clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp`. Diagnostics for types that are valid for use as kernel names will be in the next PR (see currently staged changes [here](https://github.com/tahonermann/llvm-project/compare/sycl-upstream-fe-pr1...tahonermann:llvm-project:sycl-upstream-fe-pr2).

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


More information about the cfe-commits mailing list