[libcxx-commits] [libcxx] [libc++] Document that internal aliases should be marked _LIBCPP_NODEBUG (PR #122175)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 8 13:59:12 PST 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/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.


>From d6f574bbe611723f4f05945aa791740b20468662 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 8 Jan 2025 22:55:34 +0100
Subject: [PATCH] [libc++] Document that internal aliases should be marked
 _LIBCPP_NODEBUG

---
 libcxx/docs/CodingGuidelines.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libcxx/docs/CodingGuidelines.rst b/libcxx/docs/CodingGuidelines.rst
index 1bb62072e886d1..0bad28b05b15ca 100644
--- a/libcxx/docs/CodingGuidelines.rst
+++ b/libcxx/docs/CodingGuidelines.rst
@@ -184,3 +184,13 @@ headers (which is sometimes required for ``constexpr`` support).
 
 When defining a function at the ABI boundary, it can also be useful to consider which attributes (like ``[[gnu::pure]]``
 and ``[[clang::noescape]]``) can be added to the function to improve the compiler's ability to optimize.
+
+library-internal type aliases should be annotated with ``_LIBCPP_NODEBUG``
+==========================================================================
+
+Libc++ has lots of internal type aliases. Accumulated, these can result in significant amounts of debug information that
+users don't care about usually, since users don't try to debug standard library facilities in most cases. For that
+reason, all library-internal type aliases should be annotated with ``_LIBCPP_NODEBUG`` to suppress compilers from
+generating said debug information.
+
+This is enforced by the clang-tidy check ``libcpp-nodebug-on-aliases``.



More information about the libcxx-commits mailing list