summaryrefslogtreecommitdiff
path: root/docs/LanguageExtensions.rst
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-09-19 02:59:43 +0000
committerYonghong Song <yhs@fb.com>2019-09-19 02:59:43 +0000
commitbf89fb7d86986de60e99a96104c2cc97b3d56230 (patch)
treebbcd189ce0c95278a082df3cbac623aaee74b1fc /docs/LanguageExtensions.rst
parenta1445cd0340006d7635101c4c2b27ae51328642c (diff)
downloadclang-bf89fb7d86986de60e99a96104c2cc97b3d56230.tar.gz
[CLANG][BPF] change __builtin_preserve_access_index() signature
The clang intrinsic __builtin_preserve_access_index() currently has signature: const void * __builtin_preserve_access_index(const void * ptr) This may cause compiler warning when: - parameter type is "volatile void *" or "const volatile void *", or - the assign-to type of the intrinsic does not have "const" qualifier. Further, this signature does not allow dereference of the builtin result pointer as it is a "const void *" type, which adds extra step for the user to do type casting. Let us change the signature to: PointerT __builtin_preserve_access_index(PointerT ptr) such that the result and argument types are the same. With this, directly dereferencing the builtin return value becomes possible. Differential Revision: https://reviews.llvm.org/D67734 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LanguageExtensions.rst')
-rw-r--r--docs/LanguageExtensions.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst
index 80c960909f..9826c41c35 100644
--- a/docs/LanguageExtensions.rst
+++ b/docs/LanguageExtensions.rst
@@ -2353,12 +2353,14 @@ and other similar allocation libraries, and are only available in C++.
array subscript access and structure/union member access are relocatable
under bpf compile-once run-everywhere framework. Debuginfo (typically
with ``-g``) is needed, otherwise, the compiler will exit with an error.
+The return type for the intrinsic is the same as the type of the
+argument, and must be a pointer type.
**Syntax**:
.. code-block:: c
- const void * __builtin_preserve_access_index(const void * ptr)
+ PointerT __builtin_preserve_access_index(PointerT ptr)
**Example of Use**: