Skip to content

Commit 89fd428

Browse files
[SYCL] Improve diagnostic for invalid kernel name (#2749)
This patch updates the error message from `kernel name is missing` to `Unnamed type used in a SYCL kernel name` , when an unnamed lambda is set as the kernel name.
1 parent 2354002 commit 89fd428

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11071,7 +11071,7 @@ def note_invalid_type_in_sycl_kernel : Note<
1107111071
"%select{%1 should be globally-visible"
1107211072
"|unscoped enum %1 requires fixed underlying type"
1107311073
"|type %1 cannot be in the \"std\" namespace"
11074-
"|kernel name is missing"
11074+
"|unnamed type used in a SYCL kernel name"
1107511075
"}0">;
1107611076

1107711077
def err_sycl_kernel_not_function_object

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2921,7 +2921,7 @@ class SYCLKernelNameTypeVisitor
29212921
<< KernelNameType;
29222922
S.Diag(KernelInvocationFuncLoc,
29232923
diag::note_invalid_type_in_sycl_kernel)
2924-
<< /* kernel name is missing */ 3;
2924+
<< /* unnamed type used in a SYCL kernel name */ 3;
29252925
IsInvalid = true;
29262926
return;
29272927
}

clang/test/SemaSYCL/unnamed-kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int main() {
118118
cl::sycl::queue q;
119119
#ifndef __SYCL_UNNAMED_LAMBDA__
120120
// expected-error-re@Inputs/sycl.hpp:220 {{'(lambda at {{.*}}unnamed-kernel.cpp{{.*}}' is an invalid kernel name type}}
121-
// expected-note@Inputs/sycl.hpp:220 {{kernel name is missing}}
121+
// expected-note@Inputs/sycl.hpp:220 {{unnamed type used in a SYCL kernel name}}
122122
// expected-note@+2{{in instantiation of function template specialization}}
123123
#endif
124124
q.submit([&](cl::sycl::handler &h) { h.single_task([] {}); });

0 commit comments

Comments
 (0)