Skip to content

[libc++] Document that internal aliases should be marked _LIBCPP_NODEBUG #122175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

philnik777
Copy link
Contributor

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.

@philnik777 philnik777 requested a review from a team as a code owner January 8, 2025 21:59
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 8, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/122175.diff

1 Files Affected:

  • (modified) libcxx/docs/CodingGuidelines.rst (+10)
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``.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the review queue status.

@ldionne ldionne merged commit 48b2ce9 into llvm:main Jan 21, 2025
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants