[all-commits] [llvm/llvm-project] 5b37cd: [clang-tidy] Introduce HeaderFileExtensions and Im...

Carlos Galvez via All-commits all-commits at lists.llvm.org
Sun Feb 19 05:44:29 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b37cddff8e0140420ad776066529cf8f41d64d2
      https://github.com/llvm/llvm-project/commit/5b37cddff8e0140420ad776066529cf8f41d64d2
  Author: Carlos Galvez <carlosgalvezp at gmail.com>
  Date:   2023-02-19 (Sun, 19 Feb 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
    M clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
    M clang-tools-extra/clang-tidy/ClangTidyOptions.h
    A clang-tools-extra/clang-tidy/FileExtensionsSet.h
    M clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
    M clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
    M clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
    M clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.h
    M clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
    M clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
    M clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
    M clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
    M clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp
    M clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.h
    M clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
    M clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h
    M clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
    M clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
    M clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp
    M clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.h
    M clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
    M clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
    M clang-tools-extra/clang-tidy/utils/HeaderGuard.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst
    M clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst
    M clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst
    M clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst
    M clang-tools-extra/docs/clang-tidy/checks/llvmlibc/inline-function-decl.rst
    M clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst
    M clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst
    M clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst
    M clang-tools-extra/docs/clang-tidy/index.rst
    M clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp
    M clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

  Log Message:
  -----------
  [clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options

Re-introduce the patch that was reverted previously.
In the first attempt, the checks would not be able to
read from the global option, since getLocalOrGlobal
only works with string types. Additional logic is needed
in order to support both use cases in the transition
period. All that logic will be removed when the local
options are fully removed.

We have a number of checks designed to analyze problems
in header files only, for example:

bugprone-suspicious-include
google-build-namespaces
llvm-header-guard
misc-definitions-in-header
...

All these checks duplicate the same logic and options
to determine whether a location is placed in the main
source file or in the header. More checks are coming
up with similar requirements.

Thus, to remove duplication, let's move this option
to the top-level configuration of clang-tidy (since
it's something all checks should share).

Add a deprecation notice for all checks that use the
local option, prompting to update to the global option.

Differential Revision: https://reviews.llvm.org/D142655




More information about the All-commits mailing list