Page MenuHomePhabricator

[OpenCL] Improve diagnostics of OpenCL types
ClosedPublic

Authored by Anastasia on Jul 5 2016, 4:47 AM.

Details

Reviewers
yaxunl
bader
Summary

This change:

  1. Changes diagnostics for Blocks to be implicitly const qualified OpenCL v2.0 s6.12.5.
  2. Adds and unifies diagnostics of some OpenCL special types: blocks, images, samplers, pipes. These types are intended for use with the OpenCL builtin function only and, therefore, most regular uses are not allowed including assignments, arithmetic operations, pointer dereferencing, etc...

Diff Detail

Event Timeline

Anastasia updated this revision to Diff 62733.Jul 5 2016, 4:47 AM
Anastasia retitled this revision from to [OpenCL] Improve diagnostics of OpenCL types.
Anastasia updated this object.
Anastasia added reviewers: bader, yaxunl.
Anastasia added a subscriber: cfe-commits.
bader accepted this revision.Jul 5 2016, 5:05 AM
bader edited edge metadata.

LGTM.
A few minor style comments.

lib/Sema/SemaExpr.cpp
10805–10806

Please, refactor this code to use LHSTy & RHSTy.

lib/Sema/SemaType.cpp
3832

Please, add spaces around |=.

test/SemaOpenCL/invalid-pipes-cl2.0.cl
10–11

Please, remove 'gedit test.cl' at the end of the line.

test/SemaOpenCL/sampler_t.cl
22

Please, add space before {.

This revision is now accepted and ready to land.Jul 5 2016, 5:05 AM
yaxunl edited edge metadata.Jul 5 2016, 11:50 AM

Can we add tests for returning sampler, image and pipe type? Thanks.

Anastasia updated this revision to Diff 62880.Jul 6 2016, 8:26 AM
Anastasia edited edge metadata.
  • Fixed misc formatting issues
  • Added restrictions and testing for return types
yaxunl accepted this revision.Jul 6 2016, 8:37 AM
yaxunl edited edge metadata.

LGTM. Thanks!

Wondering if we should add similar restrictions for other OpenCL types incl events or queues?

Also I am guessing that the following

pipe int (*p)

should be parsed as pointer to pipe and not a pointer to a pipe element type (by analogy to function pointers or other similar declarations).

This isn't legal code I believe but the diagnostic currently doesn't seem right:

error: pipes packet types cannot be of reference type