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

Carlos Galvez via All-commits all-commits at lists.llvm.org
Mon Jan 23 12:58:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4240c9146248ac0a91c45dee421c6ef07709ba74
      https://github.com/llvm/llvm-project/commit/4240c9146248ac0a91c45dee421c6ef07709ba74
  Author: Carlos Galvez <carlosgalvezp at gmail.com>
  Date:   2023-01-23 (Mon, 23 Jan 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
    M clang-tools-extra/clang-tidy/ClangTidyOptions.h
    M clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
    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/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

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).

Since the checks fetch the option via getLocalOrGlobal,
the behavior is unchanged.

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

The functionality for parsing the option will need to
remain in the checks during the transition period.
Once the local options are fully removed, the goal
is to store the parsed options in the ClangTidyContext,
that checks can easily have access to.

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




More information about the All-commits mailing list