Skip to content

Commit 2e2425c

Browse files
committed
[SYCL] Add invalid_arg_type for function pointer after 8cc9a48 (#27942)
8cc9a48 refactored err_builtin_invalid_arg_type, readd the function pointer type for sycl.
1 parent 01e1a1b commit 2e2425c

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12653,7 +12653,7 @@ def err_builtin_invalid_arg_type: Error<
1265312653
"%plural{0:|: }1"
1265412654
// Second component: integer-like types
1265512655
"%select{|integer|signed integer|unsigned integer|'int'|"
12656-
"pointer to a valid matrix element}2"
12656+
"pointer to a valid matrix element|function pointer}2"
1265712657
// A space after a non-empty second component
1265812658
"%plural{0:|: }2"
1265912659
// An 'or' if non-empty second and third components are combined

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3026,7 +3026,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
30263026

30273027
if (!ArgTy->isFunctionProtoType() && !ArgTy->isFunctionPointerType()) {
30283028
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
3029-
<< 1 << /* pointer to function type */ 10 << ArgTy;
3029+
<< 1 << 0 << /* pointer to function type */ 6 << 0 << ArgTy;
30303030
return ExprError();
30313031
}
30323032

clang/test/SemaSYCL/builtin_sycl_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ void foo() {
7373
constexpr bool b14 = __builtin_sycl_is_kernel(&sndrk_free_func1);
7474

7575
// Test with function templates.
76-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
76+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7777
constexpr bool b15 = __builtin_sycl_is_kernel(&sndrk_free_func_tmpl1<int>);
78-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
78+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7979
constexpr bool b16 = __builtin_sycl_is_kernel(sndrk_free_func_tmpl1<int>);
8080
constexpr bool b17 = __builtin_sycl_is_kernel((void(*)(int *))sndrk_free_func_tmpl1<int>); // Okay
8181

8282

8383
// Test with overloaded functions.
84-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
84+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
8585
constexpr bool b18 = __builtin_sycl_is_kernel(ovl_free_func1);
8686
constexpr bool b19 = __builtin_sycl_is_kernel((void(*)(int *))ovl_free_func1); // Okay
8787
constexpr bool b20 = __builtin_sycl_is_kernel((void(*)(int *, int))ovl_free_func1); // Okay

clang/test/SemaSYCL/builtin_sycl_nd_range_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ void foo() {
7272
constexpr bool b14 = __builtin_sycl_is_nd_range_kernel(&sndrk_free_func1, 4); // Okay
7373

7474
// Test with function templates.
75-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
75+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7676
constexpr bool b15 = __builtin_sycl_is_nd_range_kernel(&sndrk_free_func_tmpl1<int>, 6);
77-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
77+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7878
constexpr bool b16 = __builtin_sycl_is_nd_range_kernel(sndrk_free_func_tmpl1<int>, 8);
7979
constexpr bool b17 = __builtin_sycl_is_nd_range_kernel((void(*)(int *))sndrk_free_func_tmpl1<int>, 12); // Okay
8080

8181

8282
// Test with overloaded functions.
83-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
83+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
8484
constexpr bool b18 = __builtin_sycl_is_nd_range_kernel(ovl_free_func1, 4);
8585
constexpr bool b19 = __builtin_sycl_is_nd_range_kernel((void(*)(int *))ovl_free_func1, 2); // Okay
8686
constexpr bool b20 = __builtin_sycl_is_nd_range_kernel((void(*)(int *, int))ovl_free_func1, 2); // Okay

clang/test/SemaSYCL/builtin_sycl_single_task_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ void foo() {
7373
constexpr bool b13 = __builtin_sycl_is_single_task_kernel(&sstk_free_func1); // Okay
7474

7575
// Test with function templates.
76-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
76+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7777
constexpr bool b14 = __builtin_sycl_is_single_task_kernel(&sstk_free_func_tmpl1<int>);
78-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
78+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
7979
constexpr bool b15 = __builtin_sycl_is_single_task_kernel(sstk_free_func_tmpl1<int>);
8080
constexpr bool b16 = __builtin_sycl_is_single_task_kernel((void(*)(int *))sstk_free_func_tmpl1<int>); // Okay
8181

8282

8383
// Test with overloaded functions.
84-
// expected-error@+1 {{1st argument must be a function pointer (was '<overloaded function type>')}}
84+
// expected-error@+1 {{1st argument must be a function pointer type (was '<overloaded function type>')}}
8585
constexpr bool b17 = __builtin_sycl_is_single_task_kernel(ovl_free_func1);
8686
constexpr bool b18 = __builtin_sycl_is_single_task_kernel((void(*)(int *))ovl_free_func1); // Okay
8787
constexpr bool b19 = __builtin_sycl_is_single_task_kernel((void(*)(int *, int))ovl_free_func1); // Okay

0 commit comments

Comments
 (0)