@@ -41,8 +41,8 @@ specific section:
41
41
variants depending on base language.
42
42
- :ref: `C++ Language <cxx >`
43
43
- :ref: `Objective C++ Language <objcxx >`
44
- - :ref: `OpenCL Kernel Language <opencl >`: OpenCL C v1 .0, v1 .1, v1 .2, v2 .0,
45
- plus C++ for OpenCL.
44
+ - :ref: `OpenCL Kernel Language <opencl >`: OpenCL C 1 .0, 1 .1, 1 .2, 2.0, 3 .0,
45
+ and C++ for OpenCL 1.0 and 2021 .
46
46
47
47
In addition to these base languages and their dialects, Clang supports a
48
48
broad variety of language extensions, which are documented in the
@@ -3321,20 +3321,25 @@ implementation of `OpenCL C++
3321
3321
<https://www.khronos.org/registry/OpenCL/specs/2.2/pdf/OpenCL_Cxx.pdf> `_ and
3322
3322
there is no plan to support it in clang in any new releases in the near future.
3323
3323
3324
-
3325
- Clang currently supports C++ for OpenCL v1.0.
3324
+ Clang currently supports C++ for OpenCL 1.0 and 2021.
3326
3325
For detailed information about this language refer to the C++ for OpenCL
3327
3326
Programming Language Documentation available
3328
3327
in `the latest build
3329
3328
<https://www.khronos.org/opencl/assets/CXX_for_OpenCL.html> `_
3330
3329
or in `the official release
3331
- <https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-v1.0-r2 > `_.
3330
+ <https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-docrev2021.12 > `_.
3332
3331
3333
3332
To enable the C++ for OpenCL mode, pass one of following command line options when
3334
- compiling ``.cl `` file ``-cl-std=clc++ ``, ``-cl-std=CLC++ ``, ``-cl-std=clc++1.0 ``,
3335
- ``-cl-std=CLC++1.0 ``, ``-std=clc++ ``, ``-std=CLC++ ``, ``-std=clc++1.0 `` or
3336
- ``-std=CLC++1.0 ``.
3333
+ compiling ``.clcpp `` file:
3334
+
3335
+ - C++ for OpenCL 1.0: ``-cl-std=clc++ ``, ``-cl-std=CLC++ ``, ``-cl-std=clc++1.0 ``,
3336
+ ``-cl-std=CLC++1.0 ``, ``-std=clc++ ``, ``-std=CLC++ ``, ``-std=clc++1.0 `` or
3337
+ ``-std=CLC++1.0 ``.
3338
+
3339
+ - C++ for OpenCL 2021: ``-cl-std=clc++2021 ``, ``-cl-std=CLC++2021 ``,
3340
+ ``-std=clc++2021 ``, ``-std=CLC++2021 ``.
3337
3341
3342
+ Example of use:
3338
3343
.. code-block :: c++
3339
3344
3340
3345
template<class T> T add( T x, T y )
@@ -3351,15 +3356,27 @@ compiling ``.cl`` file ``-cl-std=clc++``, ``-cl-std=CLC++``, ``-cl-std=clc++1.0`
3351
3356
3352
3357
.. code-block :: console
3353
3358
3354
- clang -cl-std=clc++ test.cl
3359
+ clang -cl-std=clc++1.0 test.clcpp
3360
+
3355
3361
3356
- Alternatively , files with ``.clcpp `` extension are compiled with the C++ for OpenCL
3357
- mode.
3362
+ By default , files with ``.clcpp `` extension are compiled with the C++ for
3363
+ OpenCL 1.0 mode.
3358
3364
3359
3365
.. code-block :: console
3360
3366
3361
3367
clang test.clcpp
3362
3368
3369
+ For backward compatibility files with ``.cl `` extensions can also be compiled
3370
+ in C++ for OpenCL mode but the desirable language mode must be activated with
3371
+ a flag.
3372
+
3373
+ .. code-block :: console
3374
+
3375
+ clang -cl-std=clc++ test.cl
3376
+
3377
+ Support of C++ for OpenCL 2021 is currently in experimental phase, refer to
3378
+ :doc: `OpenCLSupport ` for more details.
3379
+
3363
3380
C++ for OpenCL kernel sources can also be compiled online in drivers supporting
3364
3381
`cl_ext_cxx_for_opencl
3365
3382
<https://www.khronos.org/registry/OpenCL/extensions/ext/cl_ext_cxx_for_opencl.html> `_
0 commit comments