Page MenuHomePhabricator

[OpenCL] Check for invalid kernel arguments in array types
ClosedPublic

Authored by asavonic on Jul 24 2018, 4:32 AM.

Details

Summary

OpenCL specification forbids use of several types as kernel
arguments. This patch improves existing diagnostic to look through
arrays.

Diff Detail

Repository
rC Clang

Event Timeline

asavonic created this revision.Jul 24 2018, 4:32 AM
Anastasia accepted this revision.Jul 24 2018, 4:56 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Jul 24 2018, 4:56 AM
yaxunl accepted this revision.Jul 24 2018, 5:41 AM

LGTM

Btw, has this restriction been removed from CL 2.0?

asavonic updated this revision to Diff 157219.Jul 25 2018, 4:06 AM

Moved a chunk from https://reviews.llvm.org/D49725; added 2 more tests.

Btw, has this restriction been removed from CL 2.0?

No, it applies for CL2.0 as well.

Btw, has this restriction been removed from CL 2.0?

No, it applies for CL2.0 as well.

It seems however the restriction on pointer to pointer was removed (see s6.9.a last item) in CL2.0.

lib/Sema/SemaDecl.cpp
8187

Do we need to assert PT here too? It doesn't seem to be modified in this loop...

asavonic updated this revision to Diff 157685.Jul 27 2018, 7:22 AM
asavonic marked an inline comment as done.

Fix assert.

Btw, has this restriction been removed from CL 2.0?

No, it applies for CL2.0 as well.

It seems however the restriction on pointer to pointer was removed (see s6.9.a last item) in CL2.0.

Right, and it seems that pointers in struct arguments should also be legal in CL2.0.
I'll submit another patch to remove this check for CL2.0.

lib/Sema/SemaDecl.cpp
8187

We should check for a field instead. Thanks!

asavonic updated this revision to Diff 157688.Jul 27 2018, 7:26 AM

Rollback accidentally squashed commit.

Anastasia accepted this revision.Jul 27 2018, 8:38 AM

LGTM! Thanks!

yaxunl accepted this revision.Jul 27 2018, 8:28 PM

LGTM. Thanks.

This revision was automatically updated to reflect the committed changes.