[clang-tools-extra] [clang-tidy] Rename 'google-build-namespaces' check to 'misc-anonymous-namespace-in-header' and keep initial as alias. (PR #170986)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 8 00:52:00 PST 2025
=?utf-8?q?Ondřej_Štorc?= <storc.1998 at gmail.com>,Ondrej Storc
<storcond at fit.cvut.cz>,Ondrej Storc <storcond at fit.cvut.cz>,Ondrej Storc
<storcond at fit.cvut.cz>,Ondrej Storc <storcond at fit.cvut.cz>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/170986 at github.com>
================
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - anonymous-namespace-in-header
+
+anonymous-namespace-in-header
+=============================
+
+Finds anonymous namespaces in headers. Anonymous namespaces in headers can lead to
+ODR (One Definition Rule) violations, as each translation unit including the header
+will have its own unique version of the entities declared within the anonymous
+namespace. This can cause issues when linking, as the linker may see multiple
+definitions of the same entity, leading to unexpected behavior or linker errors.
----------------
zeyi2 wrote:
In other alias documentation, we use `References` which looks like [this](https://github.com/llvm/llvm-project/blob/ec1ea0a4ca02451731036ce04915e30aad0c81dd/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst?plain=1#L13), so it may be a good idea to also add them here.
```suggestion
References
----------
https://google.github.io/styleguide/cppguide.html#Namespaces
Corresponding cpplint.py check name: `build/namespaces`.
```
But will be a good idea to wait for other reviewers to verify this :)
https://github.com/llvm/llvm-project/pull/170986
More information about the cfe-commits
mailing list