Skip to content

Xmake Clang Tidy支持 #6804

@24bit-xjkp

Description

@24bit-xjkp

Xmake 版本

3.0.2

操作系统版本和架构

Linux 6.16.7-arch1-1

描述问题

  1. xmake check clang.tidy target会导致源文件列表为空:
Error: no input files specified.
USAGE: clang-tidy [options] <source0> [... <sourceN>]

OPTIONS:

因为这里filetarget都是位置参数,优先匹配到了file里,导致找不到源文件,应该将file改为kv类型。顺便是否可以将target改为vs以便支持多个target?

  1. clang-tidy串行执行

尽管提供了jobs选项,但这里不是只启动了一个clang-tidy进程就是串行地启动clang-tidy进程。而参考llvm的run-clang-tidy实现,应该让每个clang-tidy进程处理一个文件,并发多个clang-tidy进程来实现并行执行。

期待的结果

  1. 可以正常使用 xmake check clang.tidy target
  2. 可以并行执行clang-tidy

工程配置

test.zip是一个简单的工程,执行xmake check clang.tidy --compdb=.vscode test后会产生错误。

附加信息和错误日志

 xmake check clang.tidy --compdb=.vscode test
{ 
  version = "22.0.0git",
  name = "clang_tidy",
  program = "/home/luo/Toolchains/x86_64-linux-gnu-clang22/bin/clang-tidy" 
}

Error: no input files specified.
USAGE: clang-tidy [options] <source0> [... <sourceN>]

OPTIONS:

Generic Options:

  --help                           - Display available options (--help-hidden for more)
  --version                        - Display the version of this program

clang-tidy options:
...

error: execv(/home/luo/Toolchains/x86_64-linux-gnu-clang22/bin/clang-tidy -p /tmp/.xmake1000/250914/_06A771BFE21243108BACA9E9EBB26910.dir/compile_commands.json --config-file=./.clang-tidy) failed(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions