[clang] dd18729 - [Attr][Doc][NFC] Fix code snippet formatting for attribute documentation
Alexey Bader via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 21 10:38:17 PST 2020
Author: Alexey Bader
Date: 2020-01-21T18:30:56+03:00
New Revision: dd18729b2a7a23b76b8d74fbf4f4bb4efbe8aa97
URL: https://github.com/llvm/llvm-project/commit/dd18729b2a7a23b76b8d74fbf4f4bb4efbe8aa97
DIFF: https://github.com/llvm/llvm-project/commit/dd18729b2a7a23b76b8d74fbf4f4bb4efbe8aa97.diff
LOG: [Attr][Doc][NFC] Fix code snippet formatting for attribute documentation
Reviewers: aaron.ballman, Fznamznon
Subscribers: ebevhan, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73104
Added:
Modified:
clang/include/clang/Basic/AttrDocs.td
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index 456edd1daafc..8fd59a0c9b38 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -260,6 +260,7 @@ The ``sycl_kernel`` attribute specifies that a function template will be used
to outline device code and to generate an OpenCL kernel.
Here is a code example of the SYCL program, which demonstrates the compiler's
outlining job:
+
.. code-block:: c++
int foo(int x) { return ++x; }
@@ -282,27 +283,29 @@ compilation of functions for the device part can be found in the SYCL 1.2.1
specification Section 6.4.
To show to the compiler entry point to the "device part" of the code, the SYCL
runtime can use the ``sycl_kernel`` attribute in the following way:
+
.. code-block:: c++
-namespace cl {
-namespace sycl {
-class handler {
- template <typename KernelName, typename KernelType/*, ...*/>
- __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) {
- // ...
- KernelFuncObj();
- }
- template <typename KernelName, typename KernelType, int Dims>
- void parallel_for(range<Dims> NumWorkItems, KernelType KernelFunc) {
-#ifdef __SYCL_DEVICE_ONLY__
- sycl_kernel_function<KernelName, KernelType, Dims>(KernelFunc);
-#else
- // Host implementation
-#endif
- }
-};
-} // namespace sycl
-} // namespace cl
+ namespace cl {
+ namespace sycl {
+ class handler {
+ template <typename KernelName, typename KernelType/*, ...*/>
+ __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) {
+ // ...
+ KernelFuncObj();
+ }
+
+ template <typename KernelName, typename KernelType, int Dims>
+ void parallel_for(range<Dims> NumWorkItems, KernelType KernelFunc) {
+ #ifdef __SYCL_DEVICE_ONLY__
+ sycl_kernel_function<KernelName, KernelType, Dims>(KernelFunc);
+ #else
+ // Host implementation
+ #endif
+ }
+ };
+ } // namespace sycl
+ } // namespace cl
The compiler will also generate an OpenCL kernel using the function marked with
the ``sycl_kernel`` attribute.
More information about the cfe-commits
mailing list