[all-commits] [llvm/llvm-project] 7c5018: [clang-tidy] Option to ignore anonymous namespaces...

Pascal Jungblut via All-commits all-commits at lists.llvm.org
Mon Jul 1 12:13:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c50187b7d7a977144372ceff306d21d71e22e26
      https://github.com/llvm/llvm-project/commit/7c50187b7d7a977144372ceff306d21d71e22e26
  Author: Pascal Jungblut <github at pascalj.de>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidNonConstGlobalVariablesCheck.cpp
    M clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidNonConstGlobalVariablesCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-non-const-global-variables.cpp

  Log Message:
  -----------
  [clang-tidy] Option to ignore anonymous namespaces in avoid-non-const-global-variables (#93827)

Add an option to ignore warnings for cppcoreguidelines
avoid-non-const-global-variables.

Understandably, the core guidelines discourage non const global
variables, even at the TU level (see
https://github.com/isocpp/CppCoreGuidelines/issues/2195). However,
having a small TU with an interface that uses a non const variable from
an anonymous namespace can be a valid choice.

This adds an option that disables the warning just for anonymous
namespaces, i.e. at the file level. The default is still to show a
warning, just as before.



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