Files
linux/scripts/clang-tools
Pat Somaru 9362d34acf scripts/clang-tools: Handle included .c files in gen_compile_commands
The gen_compile_commands.py script currently only creates entries for the
primary source files found in .cmd files, but some kernel source files
text-include others (i.e. kernel/sched/build_policy.c).

This prevents tools like clangd from working properly on text-included c
files, such as kernel/sched/ext.c because the generated compile_commands.json
does not have entries for them.

Extend process_line() to detect when a source file includes .c files, and
generate additional compile_commands.json entries for them. For included c
files, use the same compile flags as their parent and add their parents headers.

This enables lsp tools like clangd to work properly on files like
kernel/sched/ext.c

Signed-off-by: Pat Somaru <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Tested-by: Justin Stitt <[email protected]>
Tested-by: Eduard Zingerman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Nicolas Schier <[email protected]>
2025-11-08 12:18:00 +01:00
..