summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-10 00:53:59 +0800
committerruki <[email protected]>2024-12-25 13:47:38 +0800
commitcb3d5bb913d85c1f78f916fa2d0cec63cf46e0eb (patch)
treeed63c263670f4caa2c754d486f011b64a1c18c2f
parentc2d7c1d703c6716ae46fdfad46dc09ace18be559 (diff)
improve clang-tidy to support multiple sourcefiles
-rw-r--r--xmake/modules/private/check/checkers/clang/tidy.lua22
1 files changed, 8 insertions, 14 deletions
diff --git a/xmake/modules/private/check/checkers/clang/tidy.lua b/xmake/modules/private/check/checkers/clang/tidy.lua
index d047bc541..147d3e4c6 100644
--- a/xmake/modules/private/check/checkers/clang/tidy.lua
+++ b/xmake/modules/private/check/checkers/clang/tidy.lua
@@ -81,8 +81,8 @@ function _add_target_files(sourcefiles, target)
end
end
--- check sourcefile
-function _check_sourcefile(clang_tidy, sourcefile, opt)
+-- check sourcefiles
+function _check_sourcefiles(clang_tidy, sourcefiles, opt)
opt = opt or {}
local projectdir = project.directory()
local argv = {}
@@ -108,10 +108,12 @@ function _check_sourcefile(clang_tidy, sourcefile, opt)
if opt.quiet then
table.insert(argv, "--quiet")
end
- if not path.is_absolute(sourcefile) then
- sourcefile = path.absolute(sourcefile, projectdir)
+ for _, sourcefile in ipairs(sourcefiles) do
+ if not path.is_absolute(sourcefile) then
+ sourcefile = path.absolute(sourcefile, projectdir)
+ end
+ table.insert(argv, sourcefile)
end
- table.insert(argv, sourcefile)
os.execv(clang_tidy, argv, {curdir = projectdir})
end
@@ -164,15 +166,7 @@ function _check(clang_tidy, opt)
end
-- check files
- local jobs = tonumber(opt.jobs or "1")
- runjobs("check_files", function (index)
- local sourcefile = sourcefiles[index]
- if sourcefile then
- _check_sourcefile(clang_tidy, sourcefile, opt)
- end
- end, {total = #sourcefiles,
- comax = jobs,
- isolate = true})
+ _check_sourcefiles(clang_tidy, sourcefiles, opt)
end
function main(argv)