summaryrefslogtreecommitdiffstats
path: root/scripts/clang-tools/gen_compile_commands.py
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2025-02-06 02:18:02 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2025-03-15 21:16:21 +0900
commit90efe2b9119ff8a83a67eb5323e52311a1a49de9 (patch)
tree6d455d109db17fa5fca45d644be03a1a54be48c3 /scripts/clang-tools/gen_compile_commands.py
parente966ad0edd0056c7491b8f23992c11734ab61ddf (diff)
downloadlinux-90efe2b9119ff8a83a67eb5323e52311a1a49de9.tar.gz
linux-90efe2b9119ff8a83a67eb5323e52311a1a49de9.tar.bz2
linux-90efe2b9119ff8a83a67eb5323e52311a1a49de9.zip
gen_compile_commands.py: remove code for '\#' replacement
Since commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files for future Make"), '#' in the build command is replaced with $(pound) rather than '\#'. Calling .replace(r'\#', '#') is only necessary when this tool is used to parse .*.cmd files generated by Linux 4.16 or earlier, which is unlikely to happen. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/clang-tools/gen_compile_commands.py')
-rwxr-xr-xscripts/clang-tools/gen_compile_commands.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
index e4fb686dfaa9..96e6e46ad1a7 100755
--- a/scripts/clang-tools/gen_compile_commands.py
+++ b/scripts/clang-tools/gen_compile_commands.py
@@ -167,10 +167,10 @@ def process_line(root_directory, command_prefix, file_path):
root_directory or file_directory.
"""
# The .cmd files are intended to be included directly by Make, so they
- # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the
- # kernel version). The compile_commands.json file is not interepreted
- # by Make, so this code replaces the escaped version with '#'.
- prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#')
+ # escape the pound sign '#' as '$(pound)'. The compile_commands.json file
+ # is not interepreted by Make, so this code replaces the escaped version
+ # with '#'.
+ prefix = command_prefix.replace('$(pound)', '#')
# Return the canonical path, eliminating any symbolic links encountered in the path.
abs_path = os.path.realpath(os.path.join(root_directory, file_path))