Closed yh-sb closed 4 days ago
it should has -Ixxx
flags in compile_commands.json. Won't clang-tidy look for headers from these flags? Do I need to manually tell it what headers it has?
clang-tidy doesn't get header files from compile_commands.json. It take for analysis only files which are explicitly passed in source list.
try this patch https://github.com/xmake-io/xmake/pull/5651
Unfortunately it doesn't help: headerfiles
is always empty.
Did you set add_headerfiles
?
No, I didn't specified add_headerfiles
.
If I list headers using add_headerfiles
, then clang.tidy check works fine, analyzing listed headers.
But in most common (non header-only) C++ projects, it's not mandatory to list headers in add_headerfiles
, right?
No, I didn't specified
add_headerfiles
. If I list headers usingadd_headerfiles
, then clang.tidy check works fine, analyzing listed headers.But in most common (non header-only) C++ projects, it's not mandatory to list headers in
add_headerfiles
, right?
Analyzing the header file list is not the work of xmake, it's the work of the compiler. Xmake only tells the compiler -Ixx
flags. If clang-tidy does not support -Ixxx
and the user does not specify header files, then xmake cannot do more. You can open a feature request to clang-tidy to support -Ixxx
.
Xmake Version
2.9.5
Operating System Version and Architecture
Windows 11 23H2 22631.4037
Describe Bug
I've noticed that the
xmake check clang.tidy
command doesn't check header files. As I understand, it only checks files present in compile_commands.json, which does not include header files.Do you have any ideas on how to fix this?
Expected Behavior
xmake check clang.tidy
passes all source files of the project to clang-tidy.Project Configuration
Additional Information and Error Logs
No additional information