[all-commits] [llvm/llvm-project] 6333fa: [clang-tidy] Fix broken HeaderFilterRegex when rea...

Carlos Galvez via All-commits all-commits at lists.llvm.org
Thu Apr 3 00:28:56 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6333fa5160fbde4bd2cf6afe8856695c13ab621f
      https://github.com/llvm/llvm-project/commit/6333fa5160fbde4bd2cf6afe8856695c13ab621f
  Author: Carlos Galvez <carlosgalvezp at gmail.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

  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/docs/ReleaseNotes.rst
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/.clang-tidy
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/foo.cpp
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/foo.h
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/subfolder/.clang-tidy
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/subfolder/bar.cpp
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/inheritance/subfolder/bar.h
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/simple/.clang-tidy
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/simple/foo.cpp
    A clang-tools-extra/test/clang-tidy/infrastructure/header-filter-from-config-file/simple/foo.h

  Log Message:
  -----------
  [clang-tidy] Fix broken HeaderFilterRegex when read from config file (#133582)

PR https://github.com/llvm/llvm-project/pull/91400 broke the usage of
HeaderFilterRegex via config file, because it is now created at a
different point in the execution and leads to a different value.

The result of that is that using HeaderFilterRegex only in the config
file does NOT work, in other words clang-tidy stops triggering warnings
on header files, thereby losing a lot of coverage.

This patch reverts the logic so that the header filter is created upon
calling the getHeaderFilter() function.

Additionally, this patch adds 2 unit tests to prevent regressions in the
future:

- One of them, "simple", tests the most basic use case with a single
top-level .clang-tidy file.

- The second one, "inheritance", demonstrates that the subfolder only
gets warnings from headers within it, and not from parent headers.

Fixes #118009
Fixes #121969
Fixes #133453

Co-authored-by: Carlos Gálvez <carlos.galvez at zenseact.com>



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