On 2023-07-19, Benjamin Gray wrote:
Like C source files, tooling can find it useful to have the assembly source file compilation recorded. The .S extension appears to used across all architectures. Signed-off-by: Benjamin Gray <bgray@xxxxxxxxxxxxx> --- For example, I'm prototyping adding ASM support to clangd. It can use this information to determine the architecture, macros definitions, include paths, etc. on a per-file basis. I can capture this during compilation with tools like bear, but given this script exists and the change is trivial it seems like a good idea to adjust this script too. --- scripts/clang-tools/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index 15ba56527acd..a84cc5737c2c 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' _FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.[cS]) *(;|$)' _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # The tools/ directory adopts a different build system, and produces .cmd # files in a different format. Do not support it. -- 2.41.0
Yes, this is also useful for my tool ccls:) I agree that for assembly files, the compile_commands.json entries are only useful for C preprocessing directives like #include and macros, so .S files are needed but .s files are not. In addition, the kernel doesn't seem to have .s files. Reviewed-by: Fangrui Song <maskray@xxxxxxxxxx>