Skip to content

Commit 48b2ce9

Browse files
authored
[libc++] Document that internal aliases should be marked _LIBCPP_NODEBUG (#122175)
In #118710 we've added ``_LIBCPP_NODEBUG`` to all internal aliases, but didn't actually document it. This patch adds documentation by adding the new requirement and reasoning to the coding guidelines.
1 parent 659e66e commit 48b2ce9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libcxx/docs/CodingGuidelines.rst

+10
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,13 @@ headers (which is sometimes required for ``constexpr`` support).
184184

185185
When defining a function at the ABI boundary, it can also be useful to consider which attributes (like ``[[gnu::pure]]``
186186
and ``[[clang::noescape]]``) can be added to the function to improve the compiler's ability to optimize.
187+
188+
Library-internal type aliases should be annotated with ``_LIBCPP_NODEBUG``
189+
==========================================================================
190+
191+
Libc++ has lots of internal type aliases. Accumulated, these can result in significant amounts of debug information that
192+
users generally don't care about, since users don't try to debug standard library facilities in most cases. For that
193+
reason, all library-internal type aliases that aren't function-local should be annotated with ``_LIBCPP_NODEBUG`` to
194+
prevent compilers from generating said debug information.
195+
196+
This is enforced by the clang-tidy check ``libcpp-nodebug-on-aliases``.

0 commit comments

Comments
 (0)