[llvm-branch-commits] [llvm] 10b5eae - [SmallVector] Copy new docs into Doxygen comment

Scott Linder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 10 14:24:59 PST 2020


Author: Scott Linder
Date: 2020-12-10T22:20:37Z
New Revision: 10b5eaed917d6f91aa2d416c08c93697bd1d446f

URL: https://github.com/llvm/llvm-project/commit/10b5eaed917d6f91aa2d416c08c93697bd1d446f
DIFF: https://github.com/llvm/llvm-project/commit/10b5eaed917d6f91aa2d416c08c93697bd1d446f.diff

LOG: [SmallVector] Copy new docs into Doxygen comment

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

Added: 
    

Modified: 
    llvm/include/llvm/ADT/SmallVector.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 1b2787b88932..10b9d4e9c0f1 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -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>


        


More information about the llvm-branch-commits mailing list