diff options
| author | Pat Somaru <patso@likewhatevs.io> | 2025-10-07 20:45:28 -0400 |
|---|---|---|
| committer | Nicolas Schier <nsc@kernel.org> | 2025-11-08 12:18:00 +0100 |
| commit | 9362d34acf91a706c543d919ade3e651b9bd2d6f (patch) | |
| tree | 802f5a1fe94c65169bebc96c991e57eacf1bb586 /tools/lib/python/abi/helpers.py | |
| parent | 2d7eda1db504e98650c03706e8c551b35a468c34 (diff) | |
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 <patso@likewhatevs.io>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Justin Stitt <justinstitt@google.com>
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://patch.msgid.link/20251008004615.2690081-1-patso@likewhatevs.io
Signed-off-by: Nicolas Schier <nsc@kernel.org>
Diffstat (limited to 'tools/lib/python/abi/helpers.py')
0 files changed, 0 insertions, 0 deletions
