summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-08 23:34:46 +0800
committerruki <[email protected]>2024-09-08 23:34:46 +0800
commitc5db7c2c29accf77e1255048f44e548862377ea0 (patch)
treed201d5f283d4cad931bb068507146c2329ebd1a7
parent7ae40ebaaba975239e4550159fd440bc94237764 (diff)
improve clang.tidy sourcefiles
-rw-r--r--xmake/modules/private/check/checkers/clang/tidy.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/modules/private/check/checkers/clang/tidy.lua b/xmake/modules/private/check/checkers/clang/tidy.lua
index f05d4b401..92c44e597 100644
--- a/xmake/modules/private/check/checkers/clang/tidy.lua
+++ b/xmake/modules/private/check/checkers/clang/tidy.lua
@@ -69,7 +69,15 @@ end
-- add sourcefiles in target
function _add_target_files(sourcefiles, target)
- table.join2(sourcefiles, (target:sourcefiles()))
+ for _, sourcebatch in pairs(sourcebatches) do
+ -- we can only use rulename to filter them because sourcekind may be bound to multiple rules
+ local rulename = sourcebatch.rulename
+ if rulename == "c.build" or rulename == "c++.build"
+ or rulename == "objc.build" or rulename == "objc++.build"
+ or rulename == "cuda.build" or rulename == "c++.build.modules" then
+ table.join2(sourcefiles, sourcebatch.sourcefiles)
+ end
+ end
end
-- check sourcefile