-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Copy link
Labels
Milestone
Description
Summary
Our project uses a hierarchical .clang-tidy
files to selectively enable checks for specific folders. Previously (in Clang-Tidy 18.1.x), we could rely on HeaderFilterRegex
to exclude headers in other directories from checks that were only enabled in certain subfolders. After updating to Clang-Tidy 19.1.x, the subfolder’s HeaderFilterRegex
seems to be ignored, causing unwanted warnings for headers outside the subfolder.
We traced this regression to PR #91400; reverting that PR makes Clang-Tidy 19 behave like 18 again.
Steps to Reproduce
Folder Structure
.clang-tidy
test.hpp
a/
├─ .clang-tidy
└─ main.cpp
File Contents
- Root
.clang-tidy
:
HeaderFilterRegex: '.*'
Checks: -.*
- Root
test.hpp
:
int test() {
return (int)4.0; // violates google-readability-casting
}
- Subfolder
a/.clang-tidy
:
InheritParentConfig: true
HeaderFilterRegex: '.*a/.*'
Checks: google-readability-casting
- Subfolder
a/main.cpp
:
#include "test.hpp"
int main() {
return test();
}
Steps to reproduce
With clang-18 (Expected Behavior)
> clang-tidy-18 a/main.cpp --quiet -- -I.
1 warning generated.
With clang-19 (Regression)
> clang-tidy-19 a/main.cpp --quiet -- -I.
1 warning generated.
./test.hpp:2:10: error: C-style casts are discouraged; use static_cast [google-readability-casting,-warnings-as-errors]
2 | return (int)4.0;
| ^~~~~
| static_cast<int>( )
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done