Issue 97655
Summary [libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration over LIBC_NAMESPACE
Labels libc
Assignees
Reporter PiJoules
    #97109 introduces `LIBC_NAMESPACE_DECL` which defines to `LIBC_NAMESPACE` with a hidden visibility attribute. `namespace LIBC_NAMESPACE_DECL {` should be used over `namespace LIBC_NAMESPACE {` when declaring a namespace which will contain internal functions/globals. This ensures anything declared in `LIBC_NAMESPACE_DECL` will have hidden visibility independent of the build system or global compile flags controlling visibility. Note this won't affect the visibility of public C functions. Those are controlled via `LLVM_LIBC_FUNCTION_ATTR`. Once #97109 lands, we should go and fix all uses of the old style to use this new style.

Copied from https://github.com/llvm/llvm-project/pull/97109#discussion_r1664851925, we should:

1. Define new macro and update docs to say how to use it correctly. That can land without other blockers.
2. Update clang-tidy checks to enforce the new standard, making sure they have full fixit implementation. That shouldn't land quite yet because then the libc linter bot will start complaining anew.
3. Use clang-tidy to apply fixups to all libc code so it now conforms. No manual edits should be needed, but manual audit is needed to be sure it caught everything and the fixit edits were correct.
4. Land 2. & 3. either in quick succession or as one commit, not sure how much it matters if everybody who would look at the libc linter bot knows what's being done.

`git grep LIBC_NAMESPACE -- 'libc*.rst'` shows other example snippets that are violating the new style requirement, so those should be updated too. We can fix that up when we land the changes to the clang-tidy check's implementation.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to