Author: Tom Honermann
Date: 2025-08-21T14:47:07-04:00
New Revision: c80b7822e3bd0be39f65cc10dd7bead93388274f

URL: 
https://github.com/llvm/llvm-project/commit/c80b7822e3bd0be39f65cc10dd7bead93388274f
DIFF: 
https://github.com/llvm/llvm-project/commit/c80b7822e3bd0be39f65cc10dd7bead93388274f.diff

LOG: [NFC][SYCL] Test use of sycl_kernel_entry_point with null declarations and 
statements. (#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.

Added: 
    

Modified: 
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp

Removed: 
    


################################################################################
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