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

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 10:40:58 PDT 2024


================
@@ -14296,6 +14296,31 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
   }
 }
 
+static SYCLKernelInfo BuildSYCLKernelInfo(ASTContext &Context,
+                                          CanQualType KernelNameType,
+                                          const FunctionDecl *FD) {
+  return { KernelNameType, FD };
+}
+
+void ASTContext::registerSYCLEntryPointFunction(FunctionDecl *FD) {
+  assert(!FD->isInvalidDecl());
+  assert(!FD->isDependentContext());
----------------
tahonermann wrote:

I changed the code to use `isTemplated()` instead of `isDependentContext()`, so resolving this conversation now.

I wasn't able to identify a test case where it made a difference, but the change seems right regardless. I added a test for a dependent friend function for the next PR. The test looks like:
```
template<typename KNT>
struct S7 {
  [[clang::sycl_kernel_entry_point(KNT)]]
  friend void ok7(S7) {}
};
void test_ok7() {
  ok7(S7<KN<7>>{});
}
```

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


More information about the cfe-commits mailing list