[clang] [SYCL] The sycl_kernel_entry_point attribute. (PR #111389)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 30 07:37:14 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());
+
+ const auto *SKEPAttr = FD->getAttr<SYCLKernelEntryPointAttr>();
+ assert(SKEPAttr && "Missing sycl_kernel_entry_point attribute");
+
+ CanQualType KernelNameType = getCanonicalType(SKEPAttr->getKernelName());
+ auto IT = SYCLKernels.find(KernelNameType);
+ if (IT != SYCLKernels.end()) {
+ if (!declaresSameEntity(FD, IT->second.GetKernelEntryPointDecl()))
+ llvm::report_fatal_error("SYCL kernel name conflict");
----------------
tahonermann wrote:
This isn't intended to be a temporary fatal error. Diagnostics should be (and are in the [staged changes for the next PR](https://github.com/tahonermann/llvm-project/compare/sycl-upstream-fe-pr1...tahonermann:llvm-project:sycl-upstream-fe-pr2)) issued before registration is attempted. This is intended to catch future bugs where diagnostics are missing. I chose `report_fatal_error()` over `assert()` to ensure such problems are revealed in release builds since a conflicting registration would indicate a bad situation that should never be permitted to escape until run-time.
https://github.com/llvm/llvm-project/pull/111389
More information about the cfe-commits
mailing list