forked from OSchip/llvm-project
[OpenCL] Fix diagnosing enqueue_kernel call with too few args
The err_typecheck_call_too_few_args diagnostic takes arguments, but none were provided causing clang to crash when attempting to diagnose an enqueue_kernel call with too few arguments. Fixes llvm.org/PR42045 Differential Revision: https://reviews.llvm.org/D66883 llvm-svn: 370322
This commit is contained in:
parent
3c790585e7
commit
a280b63ead
|
@ -629,7 +629,9 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
|
|||
unsigned NumArgs = TheCall->getNumArgs();
|
||||
|
||||
if (NumArgs < 4) {
|
||||
S.Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_few_args);
|
||||
S.Diag(TheCall->getBeginLoc(),
|
||||
diag::err_typecheck_call_too_few_args_at_least)
|
||||
<< 0 << 4 << NumArgs;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,8 @@ kernel void enqueue_kernel_tests() {
|
|||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, &evt); // expected-error{{illegal call to enqueue_kernel, incorrect argument types}}
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, 1); // expected-error{{illegal call to enqueue_kernel, incorrect argument types}}
|
||||
|
||||
enqueue_kernel(default_queue, ndrange, ^{}); // expected-error{{too few arguments to function call, expected at least 4, have 3}}
|
||||
}
|
||||
|
||||
// Diagnostic tests for get_kernel_work_group_size and allowed block parameter types in dynamic parallelism.
|
||||
|
|
Loading…
Reference in New Issue