Commit Graph

9 Commits

Author SHA1 Message Date
Sven van Haastregt 2ca6ba1045 [OpenCL] Restrict various keywords in OpenCL C++ mode
Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.

 - dynamic_cast
 - typeid
 - register (already restricted in OpenCL C, update the diagnostic)
 - thread_local
 - exceptions (try/catch/throw)
 - access qualifiers read_only, write_only, read_write

Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++.  Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++.  libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.

Differential Revision: https://reviews.llvm.org/D46022

llvm-svn: 331874
2018-05-09 13:16:17 +00:00
Yaxun Liu 39cf40f6b4 [OpenCL] Add supported OpenCL extensions to target info.
Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line.

Re-commit after fixing build error due to missing override attribute.

Differential Revision: http://reviews.llvm.org/D19484

llvm-svn: 269670
2016-05-16 17:06:34 +00:00
Yaxun Liu fa1df45c0d Revert "[OpenCL] Add supported OpenCL extensions to target info."
Revert r269431 due to build failure caused by warning msg:

  llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 'setSupportedOpenCLOpts' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
   void setSupportedOpenCLOpts() {

llvm-svn: 269435
2016-05-13 17:16:26 +00:00
Yaxun Liu 64936ce91d [OpenCL] Add supported OpenCL extensions to target info.
Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line.

Differential Revision: http://reviews.llvm.org/D19484

llvm-svn: 269431
2016-05-13 15:44:37 +00:00
Anastasia Stulova 43ab9a00eb [OpenCL] Output OpenCL version in diagnostics.
Diagnostics should note version dependent issues by giving
a hint about current version being compiled for.

This patch changes diagnostics of static storage class specifier
and generic type qualifier to specify OpenCL version as well as
converts other diagnostics to match the style.

Patch by Vedran Miletic!

Review: http://reviews.llvm.org/D19780
llvm-svn: 269305
2016-05-12 16:28:25 +00:00
Anastasia Stulova 782d5f43ca [OpenCL] Improve diagnostics of address spaces for variables in function
- Prevent local variables to be declared in global AS
 - Diagnose AS of local variables with an extern storage class
   as if they would be in a program scope

Review: http://reviews.llvm.org/D17345
llvm-svn: 262641
2016-03-03 18:38:40 +00:00
Anastasia Stulova bcea69669f [OpenCL 2.0] Enable program scope variables, Section 6.5.1.
- Remove virtual SC_OpenCLWorkGroupLocal storage type specifier
as it conflicts with static local variables now and prevents
diagnosing static local address space variables correctly.

 - Allow static local and global variables (OpenCL2.0 s6.8 and s6.5.1).

 - Improve diagnostics of allowed ASes for variables in different scopes:
(i) Global or static local variables have to be in global
or constant ASes (OpenCL1.2 s6.5, OpenCL2.0 s6.5.1);
(ii) Non-kernel function variables can't be declared in local
or constant ASes (OpenCL1.1 s6.5.2 and s6.5.3).

http://reviews.llvm.org/D13105

llvm-svn: 248906
2015-09-30 14:08:20 +00:00
Peter Collingbourne 485b80fecc OpenCL: add a non-standard extension, cl_clang_storage_class_specifiers,
which enables support for C99 storage-class specifiers.

This extension is intended to be used by implementations to implement
OpenCL C built-in functions.

llvm-svn: 141271
2011-10-06 03:01:00 +00:00
Peter Collingbourne e91b2dbdf1 OpenCL: standardise naming of test cases
llvm-svn: 125590
2011-02-15 19:46:41 +00:00