- 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
If no error occures, you will find compile_commands.json
in /path/to/kernel_source/
.
- Configure the
clangd
plugin with the following parameters:
- Open any
C
file in kernel source and enjoy it :)