Skip to content

Commit 2fe5f39

Browse files
Address comments.
1 parent 6e03f43 commit 2fe5f39

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

llvm/docs/ProgrammersManual.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,31 +1579,31 @@ llvm/ADT/SmallVector.h
15791579
``SmallVector<Type, N>`` is a simple class that looks and smells just like
15801580
``vector<Type>``: it supports efficient iteration, lays out elements in memory
15811581
order (so you can do pointer arithmetic between elements), supports efficient
1582-
push_back/pop_back operations, supports efficient random access to its elements,
1582+
``push_back``/``pop_back`` operations, supports efficient random access to its elements,
15831583
etc.
15841584

1585-
The main advantage of SmallVector is that it allocates space for some number of
1586-
elements (N) **in the object itself**. Because of this, if the SmallVector is
1585+
The main advantage of ``SmallVector`` is that it allocates space for some number of
1586+
elements (N) **in the object itself**. Because of this, if the ``SmallVector`` is
15871587
dynamically smaller than N, no malloc is performed. This can be a big win in
15881588
cases where the malloc/free call is far more expensive than the code that
15891589
fiddles around with the elements.
15901590

15911591
This is good for vectors that are "usually small" (e.g. the number of
15921592
predecessors/successors of a block is usually less than 8). On the other hand,
1593-
this makes the size of the SmallVector itself large, so you don't want to
1593+
this makes the size of the ``SmallVector`` itself large, so you don't want to
15941594
allocate lots of them (doing so will waste a lot of space). As such,
1595-
SmallVectors are most useful when on the stack.
1595+
``SmallVector``s are most useful when on the stack.
15961596
15971597
In the absence of a well-motivated choice for the number of
15981598
inlined elements ``N``, it is recommended to use ``SmallVector<T>`` (that is,
15991599
omitting the ``N``). This will choose a default number of
16001600
inlined elements reasonable for allocation on the stack (for example, trying
16011601
to keep ``sizeof(SmallVector<T>)`` around 64 bytes).
16021602

1603-
SmallVector also provides a nice portable and efficient replacement for
1603+
``SmallVector`` also provides a nice portable and efficient replacement for
16041604
``alloca``.
16051605

1606-
SmallVector has grown a few other minor advantages over ``std::vector``, causing
1606+
``SmallVector`` has grown a few other minor advantages over ``std::vector``, causing
16071607
``SmallVector<Type, 0>`` to be preferred over ``std::vector<Type>``.
16081608

16091609
#. ``std::vector`` is exception-safe, and some implementations have pessimizations
@@ -1895,7 +1895,7 @@ Note that it is generally preferred to *not* pass strings around as ``const
18951895
char*``'s. These have a number of problems, including the fact that they
18961896
cannot represent embedded nul ("\0") characters, and do not have a length
18971897
available efficiently. The general replacement for '``const char*``' is
1898-
StringRef.
1898+
``StringRef``.
18991899

19001900
For more information on choosing string containers for APIs, please see
19011901
:ref:`Passing Strings <string_apis>`.
@@ -1905,7 +1905,7 @@ For more information on choosing string containers for APIs, please see
19051905
llvm/ADT/StringRef.h
19061906
^^^^^^^^^^^^^^^^^^^^
19071907

1908-
The StringRef class is a simple value class that contains a pointer to a
1908+
The ``StringRef`` class is a simple value class that contains a pointer to a
19091909
character and a length, and is quite related to the :ref:`ArrayRef
19101910
<dss_arrayref>` class (but specialized for arrays of characters). Because
19111911
``StringRef`` carries a length with it, it safely handles strings with embedded nul
@@ -1915,14 +1915,14 @@ represents.
19151915

19161916
``StringRef`` is ideal for passing simple strings around that are known to be live,
19171917
either because they are C string literals, ``std::string``, a C array, or a
1918-
SmallVector. Each of these cases has an efficient implicit conversion to
1919-
StringRef, which doesn't result in a dynamic strlen being executed.
1918+
``SmallVector``. Each of these cases has an efficient implicit conversion to
1919+
``StringRef``, which doesn't result in a dynamic ``strlen`` being executed.
19201920

1921-
StringRef has a few major limitations which make more powerful string containers
1921+
``StringRef`` has a few major limitations which make more powerful string containers
19221922
useful:
19231923

19241924
#. You cannot directly convert a ``StringRef`` to a 'const char*' because there is
1925-
no way to add a trailing nul (unlike the .c_str() method on various stronger
1925+
no way to add a trailing nul (unlike the ``.c_str()`` method on various stronger
19261926
classes).
19271927

19281928
#. ``StringRef`` doesn't own or keep alive the underlying string bytes.

0 commit comments

Comments
 (0)