Skip to content

Conversation

@tahonermann
Copy link
Contributor

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.

…s 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.
@tahonermann tahonermann self-assigned this Aug 20, 2025
@tahonermann tahonermann added the SYCL https://registry.khronos.org/SYCL label Aug 20, 2025
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@schittir schittir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you.

@tahonermann tahonermann marked this pull request as ready for review August 20, 2025 21:26
@tahonermann tahonermann requested a review from erichkeane August 20, 2025 21:26
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Aug 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 20, 2025

@llvm/pr-subscribers-clang

Author: Tom Honermann (tahonermann)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/154583.diff

1 Files Affected:

  • (modified) clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp (+13)
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>)]];
+};

@tahonermann tahonermann merged commit c80b782 into llvm:main Aug 21, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category SYCL https://registry.khronos.org/SYCL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants