Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -12414,6 +12414,14 @@ def err_sycl_kernel_incorrectly_named : Error<
"'-fsycl-unnamed-lambda' to enable unnamed kernel lambdas"
"}0">;

// SYCL free function kernels extension.
def err_bad_free_function_kernel_param_type : Error<
"%0 cannot be used as the type of a free function kernel parameter">;
def note_free_function_kernel_param_type_not_fwd_declarable : Note<
"%0 is not forward declarable">;
def note_free_function_kernel_param_type_not_supported : Note<
"%0 is not yet supported as free function kernel parameter">;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"%0 is not yet supported as free function kernel parameter">;
"%0 is not yet supported as a free function kernel parameter">;

Copy link
Contributor

@elizabethandrews elizabethandrews Sep 24, 2024

Choose a reason for hiding this comment

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

I think having different diagnostics for free function parameter type and kernel param type is unnecessary. Other than the diagnostics you added/modified in this PR, won't other invalid types in free functions generate the old diagnostic err_bad_kernel_param_type? IMO I think we can keep the old diagnostic, passing type to it. The note diagnostic can be generated additionally for extra information where required

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree the diagnostics could be unified, but that would require changes to the existing diagnostics since their message text explicitly references the concept of a "kernel name". I'm not sure such unification would provide much benefit.

def err_nullptr_t_type_in_sycl_kernel : Error<"%0 is an invalid kernel name, "
                                        "'std::nullptr_t' is declared in the 'std' namespace ">;
def err_invalid_std_type_in_sycl_kernel : Error<"%0 is an invalid kernel name, " 
                                          "%q1 is declared in the 'std' namespace ">;
def err_sycl_kernel_incorrectly_named : Error<
  "%select{%1 is invalid; kernel name should be forward declarable "
  "at namespace scope"
  "|unscoped enum %1 requires fixed underlying type"
  "|unnamed type %1 is invalid; provide a kernel name, or use "
  "'-fsycl-unnamed-lambda' to enable unnamed kernel lambdas"
  "}0">;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used err_bad_kernel_param_type instead of a new one.

@tahonermann , I think @elizabethandrews meant another set of diagnostics.


def err_sycl_kernel_not_function_object
: Error<"kernel parameter must be a lambda or function object">;
def err_sycl_restrict : Error<
Expand Down
Loading
Loading