[PATCH] Error on illegal OpenCL kernel argument types

Matt Arsenault Matthew.Arsenault at amd.com
Fri Jul 19 15:33:29 PDT 2013


  Change wording of nested struct notes, remove old Sema member declaration, fix pop_back on empty vector.

  Add cache of valid types encountered (but only is within the same kernel declaration).


  error: struct kernel parameters may not contain OpenCL objects
  kernel void pointer_in_nested_struct_arg(struct NestedPointer arg) { }
                                                                ^
  /tmp/arst.cl:23:8: note: within field of type 'NestedPointer' declared here
  struct NestedPointer
         ^
  /tmp/arst.cl:27:14: note: within field of type 'struct Inner' declared here
  struct Inner inner;
               ^
  /tmp/arst.cl:20:19: note: within field of type 'struct InnerInner' declared here
  struct InnerInner b;
                    ^
  /tmp/arst.cl:4:6: note: field of illegal pointer type 'int *' declared here
  int* foo;
       ^
  Or for a non-pointer
  error: 'struct NestedBool' cannot be used as the type of a kernel parameter
  kernel void bool_in_nested_struct_arg(struct NestedBool arg) { }
                                                          ^
  /tmp/arst.cl:23:8: note: within field of type 'NestedBool' declared here
  struct NestedBool
         ^
  /tmp/arst.cl:27:14: note: within field of type 'struct Inner' declared here
  struct Inner inner;
               ^
  /tmp/arst.cl:20:19: note: within field of type 'struct InnerInner' declared here
  struct InnerInner b;
                    ^
  /tmp/arst.cl:4:6: note: field of illegal type 'bool' declared here
  bool foo;

Hi rsmith,

http://llvm-reviews.chandlerc.com/D1052

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1052?vs=2785&id=2921#toc

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  test/SemaOpenCL/event_t.cl
  test/SemaOpenCL/invalid-kernel-parameters.cl
  test/SemaOpenCL/invalid-kernel.cl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1052.4.patch
Type: text/x-patch
Size: 15190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130719/3ef0ce49/attachment.bin>


More information about the cfe-commits mailing list