Skip to content

Commit f44c18a

Browse files
authored
[NFC][CodingStandard] Fix text style for C++ keywords (#128932)
Fix C++ keywords in Restrict Visibility section to use `` (inline literal) markup to be consistent with the rest of the doc.
1 parent d9ac5d0 commit f44c18a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

llvm/docs/CodingStandards.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,19 +1583,20 @@ Restrict Visibility
15831583
^^^^^^^^^^^^^^^^^^^
15841584

15851585
Functions and variables should have the most restricted visibility possible.
1586-
For class members, that means using appropriate `private`, `protected`, or `public`
1587-
keyword to restrict their access. For non-member functions, variables, and classes,
1588-
that means restricting visibility to a single `.cpp` file if it's not referenced
1589-
outside that file.
1586+
For class members, that means using appropriate ``private``, ``protected``, or
1587+
``public`` keyword to restrict their access. For non-member functions, variables,
1588+
and classes, that means restricting visibility to a single ``.cpp`` file if it's
1589+
not referenced outside that file.
15901590

15911591
Visibility of file-scope non-member variables and functions can be restricted to
1592-
the current translation unit by using either the `static` keyword or an anonymous namespace.
1593-
Anonymous namespaces are a great language feature that tells the C++ compiler that
1594-
the contents of the namespace are only visible within the current translation unit,
1595-
allowing more aggressive optimization and eliminating the possibility of symbol
1596-
name collisions. Anonymous namespaces are to C++ as `static` is to C functions and
1597-
global variables. While `static` is available in C++, anonymous namespaces are more
1598-
general: they can make entire classes private to a file.
1592+
the current translation unit by using either the ``static`` keyword or an anonymous
1593+
namespace. Anonymous namespaces are a great language feature that tells the C++
1594+
compiler that the contents of the namespace are only visible within the current
1595+
translation unit, allowing more aggressive optimization and eliminating the
1596+
possibility of symbol name collisions. Anonymous namespaces are to C++ as
1597+
``static`` is to C functions and global variables. While ``static`` is available
1598+
in C++, anonymous namespaces are more general: they can make entire classes
1599+
private to a file.
15991600

16001601
The problem with anonymous namespaces is that they naturally want to encourage
16011602
indentation of their body, and they reduce locality of reference: if you see a

0 commit comments

Comments
 (0)