This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Allow partial initializer for array and struct
ClosedPublic

Authored by yaxunl on Oct 6 2016, 10:25 AM.

Details

Summary

Currently Clang allows partial initializer for C99 but not for OpenCL, e.g.

float a[16][16] = {1.0f, 2.0f};

is allowed in C99 but not allowed in OpenCL.

This patch fixes that.

Diff Detail

Repository
rL LLVM

Event Timeline

yaxunl updated this revision to Diff 73818.Oct 6 2016, 10:25 AM
yaxunl retitled this revision from to [OpenCL] Allow partial initializer for array and struct.
yaxunl updated this object.
yaxunl added reviewers: Anastasia, bader.
yaxunl added a subscriber: cfe-commits.
Anastasia accepted this revision.Oct 8 2016, 4:59 AM
Anastasia edited edge metadata.

LGTM!

test/CodeGenOpenCL/partial_initializer.cl
5 ↗(On Diff #73818)

These could be moved down to each member.

This revision is now accepted and ready to land.Oct 8 2016, 4:59 AM
yaxunl added inline comments.Oct 11 2016, 8:38 AM
test/CodeGenOpenCL/partial_initializer.cl
5 ↗(On Diff #73818)

Will do when committing. Thanks.

This revision was automatically updated to reflect the committed changes.