diff options
author | Ian Rogers <[email protected]> | 2023-10-09 11:39:02 -0700 |
---|---|---|
committer | Namhyung Kim <[email protected]> | 2023-10-12 10:01:55 -0700 |
commit | 52c15e7e792857c42b4a926e45228e981c5a5f13 (patch) | |
tree | 443ff6afb0ba82302acf7cc44c906df2426e299e | |
parent | b20576fd7fe39554b212095c3c0d7a3dff512515 (diff) |
gen_compile_commands: Allow the line prefix to still be cmd_
Builds in tools still use the cmd_ prefix in .cmd files, so don't
require the saved part. Name the groups in the line pattern match so
that changing the regular expression is more robust and works with the
addition of a new match group.
Signed-off-by: Ian Rogers <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: [email protected]
Cc: Ming Wang <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
-rwxr-xr-x | scripts/clang-tools/gen_compile_commands.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index a84cc5737c2c..b43f9149893c 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 := (.* )([^ ]*\.[cS]) *(;|$)' +_LINE_PATTERN = r'^(saved)?cmd_[^ ]*\.o := (?P<command_prefix>.* )(?P<file_path>[^ ]*\.[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. @@ -213,8 +213,8 @@ def main(): result = line_matcher.match(f.readline()) if result: try: - entry = process_line(directory, result.group(1), - result.group(2)) + entry = process_line(directory, result.group('command_prefix'), + result.group('file_path')) compile_commands.append(entry) except ValueError as err: logging.info('Could not add line from %s: %s', |