Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support verilator for compdb #5635

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions xmake/plugins/project/clang/compile_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

-- imports
import("core.base.option")
import("core.base.hashset")
import("core.tool.compiler")
import("core.project.rule")
import("core.project.project")
Expand All @@ -46,6 +47,16 @@ function _sourcebatch_is_built(sourcebatch)
end
end

-- Is there other supported source file, which come from custom rules?
function _is_other_sourcefile(sourcefile)
local extensions = _g._other_supported_exts
if extensions == nil then
extensions = hashset.from({".v", ".sv"})
_g._other_supported_exts = extensions
end
return extensions:has(path.extension(sourcefile))
end

-- get LSP, clangd, ccls, ...
function _get_lsp()
local lsp = option.get("lsp")
Expand Down Expand Up @@ -154,6 +165,10 @@ function _make_arguments(jsonfile, arguments, opt)
local sourcekind = try {function () return language.sourcekind_of(path.filename(arg)) end}
if sourcekind and os.isfile(arg) then
sourcefile = tostring(arg)
elseif _is_other_sourcefile(arg) and os.isfile(arg) then
sourcefile = tostring(arg)
end
if sourcefile then
break
end
end
Expand Down
Loading