[PATCH] D46022: [OpenCL] Restrict various keywords in OpenCL C++ mode

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 24 09:34:46 PDT 2018


svenvh created this revision.
svenvh added reviewers: yaxunl, bader.
Herald added subscribers: cfe-commits, Anastasia.

Restrict the following keywords in the OpenCL C++ language mode,
according to Section 2.9 of the OpenCL C++ 1.0 Specification.

- dynamic_cast
- typeid
- goto
- register (already restricted in OpenCL C, update the diagnostic)
- thread_local
- asm
- exceptions (try/catch/throw)

Support the __global, __local, __constant, __private, and __generic
keywords in OpenCL C++.  OpenCL C++ does not provide the unprefixed
address space qualifiers such as global.  Instead, libclcxx provides
explicit address space pointer classes such as global_ptr and
global<T> that are implemented using the __-prefixed qualifiers.

This patch is only a first stab at implementing the restrictions of
OpenCL C++ and is by no means complete.  It primarily covers
restrictions that are easily caught before Sema.


Repository:
  rC Clang

https://reviews.llvm.org/D46022

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TokenKinds.def
  include/clang/Sema/DeclSpec.h
  lib/Basic/IdentifierTable.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Parse/ParseDecl.cpp
  lib/Sema/DeclSpec.cpp
  test/Parser/opencl-cl20.cl
  test/Parser/opencl-cxx-keywords.cl
  test/Parser/opencl-storage-class.cl
  test/SemaOpenCL/storageclass.cl
  test/SemaOpenCLCXX/restricted.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46022.143771.patch
Type: text/x-patch
Size: 23581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180424/d8047cf5/attachment-0001.bin>


More information about the cfe-commits mailing list