[SmallVector] Copy new docs into Doxygen comment
authorScott Linder <Scott.Linder@amd.com>
Thu, 10 Dec 2020 21:54:15 +0000 (21:54 +0000)
committerScott Linder <Scott.Linder@amd.com>
Thu, 10 Dec 2020 22:20:37 +0000 (22:20 +0000)
Copy the `ProgrammersManual.rst` changes from D92522 to the Doxygen
comment for `SmallVector`, to hopefully encourage new uses migrating to
the no-explicit-`N` form.

Differential Revision: https://reviews.llvm.org/D93069

llvm/include/llvm/ADT/SmallVector.h

index 1b2787b..10b9d4e 100644 (file)
@@ -1012,7 +1012,14 @@ template <typename T> struct CalculateSmallVectorDefaultInlinedElements {
 /// elements is below that threshold.  This allows normal "small" cases to be
 /// fast without losing generality for large inputs.
 ///
-/// Note that this does not attempt to be exception safe.
+/// \note
+/// In the absence of a well-motivated choice for the number of inlined
+/// elements \p N, it is recommended to use \c SmallVector<T> (that is,
+/// omitting the \p N). This will choose a default number of inlined elements
+/// reasonable for allocation on the stack (for example, trying to keep \c
+/// sizeof(SmallVector<T>) around 64 bytes).
+///
+/// \warning This does not attempt to be exception safe.
 ///
 template <typename T,
           unsigned N = CalculateSmallVectorDefaultInlinedElements<T>::value>