- Disable or uninstall the official
C/C++ plugin
. - Install the
clangd
plugin. - Build the kernel with
clang
:
/path/to/kernel_source$ make CC=clang defconfig
/path/to/kernel_source$ make CC=clang -j16
- Generate the
compile_commands.json
:
/path/to/kernel_source$ python ./scripts/clang-tools/gen_compile_commands.py