Skip to content

Commit c5db7c2

Browse files
committed
improve clang.tidy sourcefiles
1 parent 7ae40eb commit c5db7c2

File tree

1 file changed

+9
-1
lines changed
  • xmake/modules/private/check/checkers/clang

1 file changed

+9
-1
lines changed

xmake/modules/private/check/checkers/clang/tidy.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ end
6969

7070
-- add sourcefiles in target
7171
function _add_target_files(sourcefiles, target)
72-
table.join2(sourcefiles, (target:sourcefiles()))
72+
for _, sourcebatch in pairs(sourcebatches) do
73+
-- we can only use rulename to filter them because sourcekind may be bound to multiple rules
74+
local rulename = sourcebatch.rulename
75+
if rulename == "c.build" or rulename == "c++.build"
76+
or rulename == "objc.build" or rulename == "objc++.build"
77+
or rulename == "cuda.build" or rulename == "c++.build.modules" then
78+
table.join2(sourcefiles, sourcebatch.sourcefiles)
79+
end
80+
end
7381
end
7482

7583
-- check sourcefile

0 commit comments

Comments
 (0)