[PATCH] Error on illegal OpenCL kernel argument types
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Jul 12 11:17:44 PDT 2013
Make warning report which nested struct fields invalidate the argument, reporting first the outermost struct, followed by the nested fields from the outermost to the first found illegal one.
For example, for a nested struct case like this:
struct InnerInner
{
int* foo;
};
struct Valid
{
float c;
float d;
};
struct Inner
{
struct Valid v;
struct InnerInner a;
struct Valid g;
struct InnerInner b;
};
struct NestedPointer
{
int x;
struct Inner inner;
};
kernel void pointer_in_nested_struct_arg(struct NestedPointer arg) { }
The diagnostic produced is:
error: struct or union kernel parameters may not contain OpenCL objects
kernel void pointer_in_nested_struct_arg(struct NestedPointer arg, struct NestedPointer second) { }// expected-error{{struct or union kernel parameters may not contain OpenCL objects}}
^
test/SemaOpenCL/arst2.cl:29:8: note: 'NestedPointer' declared here
struct NestedPointer
^
test/SemaOpenCL/arst2.cl:32:16: note: member 'inner' declared here
struct Inner inner;
^
test/SemaOpenCL/arst2.cl:26:21: note: member 'b' declared here
struct InnerInner b;
^
test/SemaOpenCL/arst2.cl:12:8: note: member 'foo' declared here
int* foo;
^
Hi rsmith,
http://llvm-reviews.chandlerc.com/D1052
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1052?vs=2727&id=2785#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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1052.3.patch
Type: text/x-patch
Size: 14488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130712/953128bc/attachment.bin>
More information about the cfe-commits
mailing list