[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.
This commit is contained in:
Tom Honermann 2025-08-21 14:47:07 -04:00 committed by GitHub
parent de64f85f5d
commit c80b7822e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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>)]];
};