aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-03-23 16:30:46 -0700
committerRichard Smith <richard@metafoo.co.uk>2020-03-23 16:31:10 -0700
commit5bd06118c2a798f1f87b9251953bae8a27f21e5f (patch)
treed57d8511b4554ae86e4ed8bb8f24b9be04990eee
parent987f153929e813db1ea7e3354fd7a0b6b4adf4c0 (diff)
downloadllvm-5bd06118c2a798f1f87b9251953bae8a27f21e5f.zip
llvm-5bd06118c2a798f1f87b9251953bae8a27f21e5f.tar.gz
llvm-5bd06118c2a798f1f87b9251953bae8a27f21e5f.tar.bz2
Update documentation for __builtin_operator_new and
__builtin_operator_delete to match r328134.
-rw-r--r--clang/docs/LanguageExtensions.rst27
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index aee0b82..f9511dc 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2129,21 +2129,32 @@ object that overloads ``operator&``.
``__builtin_operator_new`` and ``__builtin_operator_delete``
------------------------------------------------------------
-``__builtin_operator_new`` allocates memory just like a non-placement non-class
-*new-expression*. This is exactly like directly calling the normal
-non-placement ``::operator new``, except that it allows certain optimizations
+A call to ``__builtin_operator_new(args)`` is exactly the same as a call to
+``::operator new(args)``, except that it allows certain optimizations
that the C++ standard does not permit for a direct function call to
``::operator new`` (in particular, removing ``new`` / ``delete`` pairs and
-merging allocations).
+merging allocations), and that the call is required to resolve to a
+`replaceable global allocation function
+<https://en.cppreference.com/w/cpp/memory/new/operator_new>`_.
-Likewise, ``__builtin_operator_delete`` deallocates memory just like a
-non-class *delete-expression*, and is exactly like directly calling the normal
-``::operator delete``, except that it permits optimizations. Only the unsized
-form of ``__builtin_operator_delete`` is currently available.
+Likewise, ``__builtin_operator_delete`` is exactly the same as a call to
+``::operator delete(args)``, except that it permits optimizations
+and that the call is required to resolve to a
+`replaceable global deallocation function
+<https://en.cppreference.com/w/cpp/memory/new/operator_delete>`_.
These builtins are intended for use in the implementation of ``std::allocator``
and other similar allocation libraries, and are only available in C++.
+Query for this feature with ``__has_builtin(__builtin_operator_new)`` or
+``__has_builtin(__builtin_operator_delete)``:
+
+ * If the value is at least ``201802L``, the builtins behave as described above.
+
+ * If the value is non-zero, the builtins may not support calling arbitrary
+ replaceable global (de)allocation functions, but do support calling at least
+ ``::operator new(size_t)`` and ``::operator delete(void*)``.
+
``__builtin_preserve_access_index``
-----------------------------------