Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang-tools-extra/clang-tidy/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
InheritParentConfig: true
HeaderFilterRegex: 'clang-tools-extra/clang-tidy'
ExcludeHeaderFilterRegex: 'include-cleaner|clang-query'
Copy link
Contributor Author

@vbvictor vbvictor Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to do this because I got errors from files like this:

llvm/llvm-project/clang-tools-extra/clang-tidy/misc/../../include-cleaner/include/clang-include-cleaner/Types.h:22:9

So it matched on regex clang-tools-extra/clang-tidy but actually it's header from another subproject.

If anyone have better ideas - please tell!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the relevant code:

const StringRef FileName(File->getName());
LastErrorRelatesToUserCode = LastErrorRelatesToUserCode ||
Sources.isInMainFile(Location) ||
(getHeaderFilter()->match(FileName) &&
!getExcludeHeaderFilter()->match(FileName));

Maybe we should normalize FileName before matching on it? i.e.:

clang-tools-extra/clang-tidy/misc/../../include-cleaner/include/clang-include-cleaner/Types.h
->
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the reason we have these relative paths in the first place is because include-cleaner forces us to do this:

include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../../include-cleaner/include")

...which is just really ugly. I've opened #167110 to fix it. (It happens to also fix this problem, but I think there's an underlying problem on our end too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI same happens with clang-query headers that also emit relative paths

Copy link
Contributor

@localspook localspook Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's right, that PR doesn't fully fix this problem then

Checks: >
bugprone-*,
-bugprone-assignment-in-if-condition,
Expand Down