[PATCH] D34948: [OpenCL] Generalise err_opencl_enqueue_kernel_expected_type to be used with other builtins

2017-07-05 Thread Alexey Bader via Phabricator via cfe-commits
bader added a comment.

>> Do you have another built-in in mind which can use this diagnostic message?
>>  If so, it would make sense to re-use it in the same patch.
> 
> This is split off from https://reviews.llvm.org/D33945, which I will be 
> rebasing/re-uploading once this patch is committed.

I see. Thanks for clarification.
No other comments from my side.


https://reviews.llvm.org/D34948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34948: [OpenCL] Generalise err_opencl_enqueue_kernel_expected_type to be used with other builtins

2017-07-03 Thread Joey Gouly via Phabricator via cfe-commits
joey added a comment.

In https://reviews.llvm.org/D34948#798332, @bader wrote:

> LGTM.
>  Do you have another built-in in mind which can use this diagnostic message?
>  If so, it would make sense to re-use it in the same patch.


This is split off from https://reviews.llvm.org/D33945, which I will be 
rebasing/re-uploading once this patch is committed.


https://reviews.llvm.org/D34948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34948: [OpenCL] Generalise err_opencl_enqueue_kernel_expected_type to be used with other builtins

2017-07-03 Thread Alexey Bader via Phabricator via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

LGTM.
Do you have another built-in in mind which can use this diagnostic message?
If so, it would make sense to re-use it in the same patch.


https://reviews.llvm.org/D34948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34948: [OpenCL] Generalise err_opencl_enqueue_kernel_expected_type to be used with other builtins

2017-07-03 Thread Joey Gouly via Phabricator via cfe-commits
joey created this revision.
Herald added subscribers: Anastasia, yaxunl.

Refactor err_opencl_enqueue_kernel_expected_type so that other builtins can use 
the same diagnostic.


https://reviews.llvm.org/D34948

Files:
  Sema/SemaChecking.cpp
  SemaOpenCL/cl20-device-side-enqueue.cl
  clang/Basic/DiagnosticSemaKinds.td

Index: SemaOpenCL/cl20-device-side-enqueue.cl
===
--- SemaOpenCL/cl20-device-side-enqueue.cl
+++ SemaOpenCL/cl20-device-side-enqueue.cl
@@ -19,19 +19,19 @@
 return 0;
   });
 
-  enqueue_kernel(vptr, flags, ndrange, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'queue_t' argument type}}
+  enqueue_kernel(vptr, flags, ndrange, ^(void) { // expected-error{{illegal call to 'enqueue_kernel', expected 'queue_t' argument type}}
 return 0;
   });
 
-  enqueue_kernel(default_queue, vptr, ndrange, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'kernel_enqueue_flags_t' (i.e. uint) argument type}}
+  enqueue_kernel(default_queue, vptr, ndrange, ^(void) { // expected-error{{illegal call to 'enqueue_kernel', expected 'kernel_enqueue_flags_t' (i.e. uint) argument type}}
 return 0;
   });
 
-  enqueue_kernel(default_queue, flags, vptr, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'ndrange_t' argument type}}
+  enqueue_kernel(default_queue, flags, vptr, ^(void) { // expected-error{{illegal call to 'enqueue_kernel', expected 'ndrange_t' argument type}}
 return 0;
   });
 
-  enqueue_kernel(default_queue, flags, ndrange, vptr); // expected-error{{illegal call to enqueue_kernel, expected block argument}}
+  enqueue_kernel(default_queue, flags, ndrange, vptr); // expected-error{{illegal call to 'enqueue_kernel', expected block argument}}
 
   enqueue_kernel(default_queue, flags, ndrange, ^(int i) { // expected-error{{blocks with parameters are not accepted in this prototype of enqueue_kernel call}}
 return 0;
@@ -46,21 +46,21 @@
return 0;
  });
 
-  enqueue_kernel(default_queue, flags, ndrange, vptr, _wait_list, , ^(void) { // expected-error{{illegal call to enqueue_kernel, expected integer argument type}}
+  enqueue_kernel(default_queue, flags, ndrange, vptr, _wait_list, , ^(void) { // expected-error{{illegal call to 'enqueue_kernel', expected integer argument type}}
 return 0;
   });
 
-  enqueue_kernel(default_queue, flags, ndrange, 1, vptr, , ^(void) // expected-error{{illegal call to enqueue_kernel, expected 'clk_event_t *' argument type}}
+  enqueue_kernel(default_queue, flags, ndrange, 1, vptr, , ^(void) // expected-error{{illegal call to 'enqueue_kernel', expected 'clk_event_t *' argument type}}
{
  return 0;
});
 
-  enqueue_kernel(default_queue, flags, ndrange, 1, _wait_list, vptr, ^(void) // expected-error{{illegal call to enqueue_kernel, expected 'clk_event_t *' argument type}}
+  enqueue_kernel(default_queue, flags, ndrange, 1, _wait_list, vptr, ^(void) // expected-error{{illegal call to 'enqueue_kernel', expected 'clk_event_t *' argument type}}
{
  return 0;
});
 
-  enqueue_kernel(default_queue, flags, ndrange, 1, _wait_list, , vptr); // expected-error{{illegal call to enqueue_kernel, expected block argument}}
+  enqueue_kernel(default_queue, flags, ndrange, 1, _wait_list, , vptr); // expected-error{{illegal call to 'enqueue_kernel', expected block argument}}
 
   // Testing the third overload type
   enqueue_kernel(default_queue, flags, ndrange,
Index: Sema/SemaChecking.cpp
===
--- Sema/SemaChecking.cpp
+++ Sema/SemaChecking.cpp
@@ -309,7 +309,8 @@
   Expr *BlockArg = TheCall->getArg(0);
   if (!isBlockPointer(BlockArg)) {
 S.Diag(BlockArg->getLocStart(),
-   diag::err_opencl_enqueue_kernel_expected_type) << "block";
+   diag::err_opencl_builtin_expected_type)
+<< TheCall->getDirectCallee() << "block";
 return true;
   }
   return checkOpenCLBlockArgs(S, BlockArg);
@@ -394,34 +395,34 @@
   // First argument always needs to be a queue_t type.
   if (!Arg0->getType()->isQueueT()) {
 S.Diag(TheCall->getArg(0)->getLocStart(),
-   diag::err_opencl_enqueue_kernel_expected_type)
-<< S.Context.OCLQueueTy;
+   diag::err_opencl_builtin_expected_type)
+<< TheCall->getDirectCallee() << S.Context.OCLQueueTy;
 return true;
   }
 
   // Second argument always needs to be a