https://github.com/tahonermann created 
https://github.com/llvm/llvm-project/pull/154583

The `sycl_kernel_entry_point` attribute only appertains to functions. This 
change adds missing tests to validate that an appropriate diagnostic is issued 
for likely unintentional application of the attribute to a null declaration or 
a null statement; perhaps due to an unintended semicolon.

>From f7a77358bab81d730e37dc5fd878a377b79e6840 Mon Sep 17 00:00:00 2001
From: Tom Honermann <tom.honerm...@intel.com>
Date: Wed, 20 Aug 2025 10:21:59 -0700
Subject: [PATCH] [NFC][SYCL] Test use of sycl_kernel_entry_point with null
 declarations and statements.

The sycl_kernel_entry_point attribute only appertains to functions. This
change adds missing tests to validate that an appropriate diagnostic is
issued for likely unintentional application of the attribute to a null
declaration or a null statement; perhaps due to an unintended semicolon.
---
 .../sycl-kernel-entry-point-attr-appertainment.cpp  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp 
b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
index 4774c8ef545f8..9aba284145fcb 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
@@ -360,3 +360,16 @@ void bad38() try {} catch(...) {}
 template<typename>
 [[clang::sycl_kernel_entry_point(BADKN<39>)]]
 void bad39() try {} catch(...) {}
+
+// expected-error@+1 {{'clang::sycl_kernel_entry_point' attribute only applies 
to functions}}
+[[clang::sycl_kernel_entry_point(BADKN<40>)]];
+
+void bad41() {
+  // expected-error@+1 {{'clang::sycl_kernel_entry_point' attribute cannot be 
applied to a statement}}
+  [[clang::sycl_kernel_entry_point(BADKN<41>)]];
+}
+
+struct B42 {
+  // expected-warning@+1 {{declaration does not declare anything}}
+  [[clang::sycl_kernel_entry_point(BADKN<42>)]];
+};

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to