[PATCH] D93069: [SmallVector] Copy new docs into Doxygen comment

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 13:58:48 PST 2020


scott.linder created this revision.
Herald added a subscriber: dexonsmith.
scott.linder requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I went to find a reference for the new recommended behavior in the
sources, and ended up had to refer to D92522 <https://reviews.llvm.org/D92522> to determine where it ended
up (i.e. `ProgrammersManual.rst`).

At the risk of the two copies diverging, it seemed useful to note the
new recommended use of `SmallVector` directly at the class declaration,
and also get the benefit of it appearing in a slightly emphasized way in
the rendered Doxygen.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93069

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


Index: llvm/include/llvm/ADT/SmallVector.h
===================================================================
--- llvm/include/llvm/ADT/SmallVector.h
+++ llvm/include/llvm/ADT/SmallVector.h
@@ -1012,7 +1012,14 @@
 /// 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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93069.311018.patch
Type: text/x-patch
Size: 938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201210/572158f6/attachment.bin>


More information about the llvm-commits mailing list