Skip to content

Commit c80b782

Browse files
authored
[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.
1 parent de64f85 commit c80b782

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,16 @@ void bad38() try {} catch(...) {}
360360
template<typename>
361361
[[clang::sycl_kernel_entry_point(BADKN<39>)]]
362362
void bad39() try {} catch(...) {}
363+
364+
// expected-error@+1 {{'clang::sycl_kernel_entry_point' attribute only applies to functions}}
365+
[[clang::sycl_kernel_entry_point(BADKN<40>)]];
366+
367+
void bad41() {
368+
// expected-error@+1 {{'clang::sycl_kernel_entry_point' attribute cannot be applied to a statement}}
369+
[[clang::sycl_kernel_entry_point(BADKN<41>)]];
370+
}
371+
372+
struct B42 {
373+
// expected-warning@+1 {{declaration does not declare anything}}
374+
[[clang::sycl_kernel_entry_point(BADKN<42>)]];
375+
};

0 commit comments

Comments
 (0)