From: Hu Weiwen <huww98@outlook.com>
To: llvm@lists.linux.dev
Cc: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>, Hu Weiwen <sehuww@mail.scut.edu.cn>
Subject: [PATCH] gen_compile_commands: include targets not end with .o
Date: Sun, 14 May 2023 18:19:17 +0800 [thread overview]
Message-ID: <TYCP286MB2066DEF0E1810E8BC36F533EC07B9@TYCP286MB2066.JPNP286.PROD.OUTLOOK.COM> (raw)
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
next reply other threads:[~2023-05-14 10:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-14 10:19 Hu Weiwen [this message]
2023-05-24 19:10 ` [PATCH] gen_compile_commands: include targets not end with .o 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TYCP286MB2066DEF0E1810E8BC36F533EC07B9@TYCP286MB2066.JPNP286.PROD.OUTLOOK.COM \
--to=huww98@outlook.com \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=sehuww@mail.scut.edu.cn \
--cc=trix@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.