[all-commits] [llvm/llvm-project] 45f728: [clang-tidy] Use lexical anon-ns matcher in llvm-p...

Baranov Victor via All-commits all-commits at lists.llvm.org
Sat Jul 12 10:05:27 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45f7285d0ef35615cc9ba665ed54fdb4c6d1c711
      https://github.com/llvm/llvm-project/commit/45f7285d0ef35615cc9ba665ed54fdb4c6d1c711
  Author: Baranov Victor <bar.victor.2002 at gmail.com>
  Date:   2025-07-12 (Sat, 12 Jul 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/llvm/PreferStaticOverAnonymousNamespaceCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/llvm/prefer-static-over-anonymous-namespace.cpp

  Log Message:
  -----------
  [clang-tidy] Use lexical anon-ns matcher in llvm-prefer-static-over-anonymous-namespace (#148357)

When having this code:
```cpp
namespace {
class MyClassOutOfAnon {
public:
  MyClassOutOfAnon();
} // namespace

MyClassOutOfAnon::MyClassOutOfAnon() {}
```
`MyClassOutOfAnon::MyClassOutOfAnon` is located in anonymous namespace
in `DeclContext` but outside anonymous namespace in
`LexicalDeclContext`.

For this check to work correctly, we need to check if definition is
located inside `LexicalDeclContext`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list