summaryrefslogtreecommitdiffstats
path: root/llvm/docs/ProgrammersManual.rst
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-07-17 22:43:00 +0000
committerReid Kleckner <reid@kleckner.net>2014-07-17 22:43:00 +0000
commit5c2245ba3dbf1a76ef2b7aa6231c1b14eb6b38c0 (patch)
treedd1ea1822000de0eccef7d813897a7f6b96ac985 /llvm/docs/ProgrammersManual.rst
parent62a56f39b7c5587a1b2144880500689bea5f32e4 (diff)
downloadbcm5719-llvm-5c2245ba3dbf1a76ef2b7aa6231c1b14eb6b38c0.tar.gz
bcm5719-llvm-5c2245ba3dbf1a76ef2b7aa6231c1b14eb6b38c0.zip
Remove rules against std::function from the programmer's manual
Clarify that llvm::function_ref is like StringRef for callables. llvm-svn: 213326
Diffstat (limited to 'llvm/docs/ProgrammersManual.rst')
-rw-r--r--llvm/docs/ProgrammersManual.rst20
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index 40eabbe442d..46ec15f93a3 100644
--- a/llvm/docs/ProgrammersManual.rst
+++ b/llvm/docs/ProgrammersManual.rst
@@ -298,7 +298,9 @@ The ``function_ref``
(`doxygen <http://llvm.org/doxygen/classllvm_1_1function_ref.html>`__) class
template represents a reference to a callable object, templated over the type
of the callable. This is a good choice for passing a callback to a function,
-if you don't need to hold onto the callback after the function returns.
+if you don't need to hold onto the callback after the function returns. In this
+way, ``function_ref`` is to ``std::function`` as ``StringRef`` is to
+``std::string``.
``function_ref<Ret(Param1, Param2, ...)>`` can be implicitly constructed from
any callable object that can be called with arguments of type ``Param1``,
@@ -323,17 +325,11 @@ can be called using:
return false;
});
-Note that a ``function_ref`` object contains pointers to external memory, so
-it is not generally safe to store an instance of the class (unless you know
-that the external storage will not be freed).
-``function_ref`` is small enough that it should always be passed by value.
-
-``std::function``
-^^^^^^^^^^^^^^^^^
-
-You cannot use ``std::function`` within LLVM code, because it is not supported
-by all our target toolchains.
-
+Note that a ``function_ref`` object contains pointers to external memory, so it
+is not generally safe to store an instance of the class (unless you know that
+the external storage will not be freed). If you need this ability, consider
+using ``std::function``. ``function_ref`` is small enough that it should always
+be passed by value.
.. _DEBUG:
OpenPOWER on IntegriCloud