mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Try using clangd-tidy (#5763)
Run clangd-tidy in parallel with clang-tidy, to experimentally see whether it works reasonably well. These may produce slightly different results, and it's not clear that clangd-tidy will be better, so being cautious about switching. A real possibility here is this is slower in some cases (building compile commands takes ~6m below), but faster in the extremely slow cases (when clang-tidy takes >10m). For contrast: - clang-tidy: https://github.com/carbon-language/carbon-lang/actions/runs/16038096026/job/45254162180?pr=5763 - clangd-tidy: https://github.com/carbon-language/carbon-lang/actions/runs/16038096427/job/45254164217?pr=5763
This commit is contained in:
@@ -37,9 +37,10 @@ def _build_generated_files(bazel: str, logtostderr: bool) -> None:
|
||||
kinds_query = (
|
||||
"filter("
|
||||
' ".*\\.(h|cpp|cc|c|cxx|def|inc)$",'
|
||||
' kind("(generated file|manifest_as_cpp)",'
|
||||
# tree_sitter is excluded here because it causes the query to failure on
|
||||
# `@platforms`.
|
||||
' kind("generated file", deps(//... except //utils/tree_sitter/...))'
|
||||
" deps(//... except //utils/tree_sitter/...))"
|
||||
")"
|
||||
)
|
||||
log_to = None
|
||||
@@ -50,13 +51,14 @@ def _build_generated_files(bazel: str, logtostderr: bool) -> None:
|
||||
stderr=log_to,
|
||||
encoding="utf-8",
|
||||
).splitlines()
|
||||
print(f"Found {len(generated_file_labels)} generated files...")
|
||||
print(f"Found {len(generated_file_labels)} generated files...", flush=True)
|
||||
|
||||
# Directly build these labels so that indexing can find them. Allow this to
|
||||
# fail in case there are build errors in the client, and just warn the user
|
||||
# that they may be missing generated files.
|
||||
subprocess.check_call(
|
||||
[bazel, "build", "--keep_going"] + generated_file_labels
|
||||
[bazel, "build", "--keep_going", "--remote_download_outputs=toplevel"]
|
||||
+ generated_file_labels
|
||||
)
|
||||
|
||||
|
||||
@@ -77,7 +79,10 @@ def main() -> None:
|
||||
|
||||
_build_generated_files(bazel, args.alsologtostderr)
|
||||
|
||||
print("Generating compile_commands.json (may take a few minutes)...")
|
||||
print(
|
||||
"Generating compile_commands.json (may take a few minutes)...",
|
||||
flush=True,
|
||||
)
|
||||
subprocess.run([bazel, "run", "@hedron_compile_commands//:refresh_all"])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user