Skip to content

Commit 5a1058f

Browse files
committed
improve clang.tidy ##5538
1 parent 76ab87b commit 5a1058f

File tree

1 file changed

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

1 file changed

+15
-1
lines changed

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,21 @@ function _check(clang_tidy, opt)
120120
opt = opt or {}
121121

122122
-- generate compile_commands.json first
123-
local filepath = option.get("compdb") or "compile_commands.json"
123+
local filepath = option.get("compdb")
124+
if not filepath then
125+
-- @see https://github.com/xmake-io/xmake/issues/5583#issuecomment-2337696628
126+
local outputdir
127+
local extraconf = project.extraconf("target.rules", "plugin.compile_commands.autoupdate")
128+
if extraconf then
129+
outputdir = extraconf.outputdir
130+
end
131+
if outputdir then
132+
filepath = path.join(outputdir, "compile_commands.json")
133+
end
134+
end
135+
if not filepath then
136+
filepath = "compile_commands.json"
137+
end
124138
if not os.isfile(filepath) then
125139
local outputdir = os.tmpfile() .. ".dir"
126140
local filename = path.filename(filepath)

0 commit comments

Comments
 (0)