[PATCH] D25935: [OpenCL] Diagnose variadic arguments

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 04:15:57 PDT 2016


Anastasia created this revision.
Anastasia added a reviewer: yaxunl.
Anastasia added a subscriber: cfe-commits.

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.


https://reviews.llvm.org/D25935

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaType.cpp
  test/SemaOpenCL/builtin.cl
  test/SemaOpenCL/func.cl
  test/SemaOpenCL/func_ptr.cl
  test/SemaOpenCL/invalid-block.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25935.75680.patch
Type: text/x-patch
Size: 8692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161025/be010ecf/attachment.bin>


More information about the cfe-commits mailing list