All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gen_compile_commands: include targets not end with .o
@ 2023-05-14 10:19 Hu Weiwen
  2023-05-24 19:10 ` Nick Desaulniers
  2023-05-25 12:20 ` [PATCH v2] gen_compile_commands: include targets not ending " Hu Weiwen
  0 siblings, 2 replies; 7+ messages in thread
From: Hu Weiwen @ 2023-05-14 10:19 UTC (permalink / raw)
  To: llvm; +Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Hu Weiwen

From: Hu Weiwen <sehuww@mail.scut.edu.cn>

Currently, we only extract commands for targets end with '.o'. But we
also have many standalone executables built in-tree.

Remove this restriction. And to avoid some false matching, exclude
targets end with '.c' or '.h' when directly walking the directory.

Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
 scripts/clang-tools/gen_compile_commands.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
index 15ba56527acd..6e88c7e166fc 100755
--- a/scripts/clang-tools/gen_compile_commands.py
+++ b/scripts/clang-tools/gen_compile_commands.py
@@ -18,8 +18,8 @@ import sys
 _DEFAULT_OUTPUT = 'compile_commands.json'
 _DEFAULT_LOG_LEVEL = 'WARNING'
 
-_FILENAME_PATTERN = r'^\..*\.cmd$'
-_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'
+_FILENAME_PATTERN = r'^\..*(?<!\.(c|h))\.cmd$'
+_LINE_PATTERN = r'^savedcmd_[^ ]* := (.* )([^ ]*\.c) *(;|$)'
 _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.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-02  9:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 10:19 [PATCH] gen_compile_commands: include targets not end with .o Hu Weiwen
2023-05-24 19:10 ` Nick Desaulniers
2023-05-25  9:52   ` 胡玮文
2023-05-25 12:20 ` [PATCH v2] gen_compile_commands: include targets not ending " Hu Weiwen
2023-05-29 10:13   ` Masahiro Yamada
2023-05-30  9:04     ` 胡玮文
2023-06-02  9:38       ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.