]> granicus.if.org Git - clang/commitdiff
[OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Fri, 21 Apr 2017 15:13:24 +0000 (15:13 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Fri, 21 Apr 2017 15:13:24 +0000 (15:13 +0000)
Check unqualified type for ndrange argument in device_side_enqueue so
device_side_enqueue accept const and volatile qualified ndranges.

Differential Revision: https://reviews.llvm.org/D31458

Patch by Dmitry Borisenkov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300988 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp
test/SemaOpenCL/cl20-device-side-enqueue.cl

index 45523b30ef22b9242319bb55e3bbee2da26eac6d..044ec74679d5c059c85b6afb2fd72f833d5677c2 100644 (file)
@@ -408,7 +408,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
   }
 
   // Third argument is always an ndrange_t type.
-  if (Arg2->getType().getAsString() != "ndrange_t") {
+  if (Arg2->getType().getUnqualifiedType().getAsString() != "ndrange_t") {
     S.Diag(TheCall->getArg(2)->getLocStart(),
            diag::err_opencl_enqueue_kernel_expected_type)
         << "'ndrange_t'";
index 3e87cfcddf6616a20c726a6c2a3e7ebb67af7b50..bafbe447ee2867aa97754f9412286d32a0155096 100644 (file)
@@ -1,12 +1,14 @@
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS=
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
 
 typedef struct {int a;} ndrange_t;
 // Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
 kernel void enqueue_kernel_tests() {
   queue_t default_queue;
   unsigned flags = 0;
-  ndrange_t ndrange;
+  QUALS ndrange_t ndrange;
   clk_event_t evt;
   clk_event_t event_wait_list;
   clk_event_t event_wait_list2[] = {evt, evt};