This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Diagnose variadic arguments
ClosedPublic

Authored by Anastasia on Oct 25 2016, 4:15 AM.

Details

Reviewers
yaxunl
Summary

OpenCL disallows using variadic arguments (s6.9.e and s6.12.5 OpenCL v2.0) apart from some exceptions:

  • printf
  • enqueue_kernel

This change adds error diagnostic for variadic functions but accepts printf and any compiler internal function (which should cover __enqueue_kernel_XXX cases). It also unifies diagnostic with block prototype and adds missing uncaught cases for blocks.

Note that this implementation checks against printf name. Alternative approach would be to enable printf as Clang builtin and diagnose using custom Sema checks. Though it 's not clear whether this brings any benefit.

Diff Detail

Event Timeline

Anastasia updated this revision to Diff 75680.Oct 25 2016, 4:15 AM
Anastasia retitled this revision from to [OpenCL] Diagnose variadic arguments .
Anastasia updated this object.
Anastasia added a reviewer: yaxunl.
Anastasia added a subscriber: cfe-commits.
yaxunl accepted this revision.Oct 25 2016, 7:53 AM
yaxunl edited edge metadata.

LGTM. Thanks.

This revision is now accepted and ready to land.Oct 25 2016, 7:53 AM
Anastasia closed this revision.Oct 31 2016, 10:34 AM

Committed in r285395

test/SemaOpenCL/func.cl