From 843c7ce498ea749e94c3128179f7d192890a064a Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 16 Sep 2026 20:12:32 +0000 Subject: [PATCH] Improve compilation database for agents. (#7790) Remove claim from script that it takes minutes; this caused Claude to decide to not run it. It only takes a few seconds these days. Add note in toolchain development skill that lints won't be accurate if the compilation database is outdated. Assisted-by: Claude Opus 5 via Antigravity --- .agents/skills/toolchain_development/SKILL.md | 5 +++++ scripts/create_compdb.py | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.agents/skills/toolchain_development/SKILL.md b/.agents/skills/toolchain_development/SKILL.md index 44dc7f4d70fd..b6d5b9ac50b9 100644 --- a/.agents/skills/toolchain_development/SKILL.md +++ b/.agents/skills/toolchain_development/SKILL.md @@ -158,3 +158,8 @@ operations, inspect target LLVM ADT class APIs: 8. **Redundant bounds calculations**: Avoid repeating calculations of complex boundary estimations (such as lower and upper bound estimations). Refactor the logic to calculate unified values once, preserving compactness. +9. **Trusting stale `clangd` diagnostics**: In-editor diagnostics are only as + good as `compile_commands.json`. If it predates a newly added file, `clangd` + falls back to a default command and reports nonsense, such as missing + standard headers or "no member named `None`". Regenerate it with + `./scripts/create_compdb.py`, which only takes a few seconds. diff --git a/scripts/create_compdb.py b/scripts/create_compdb.py index e718e7c012b2..f5e7d80cd478 100755 --- a/scripts/create_compdb.py +++ b/scripts/create_compdb.py @@ -196,10 +196,7 @@ def main() -> None: bazel, args.alsologtostderr, args.dump_files, args.extra_bazel_flag ) - print( - "Generating compile_commands.json (may take a few minutes)...", - flush=True, - ) + print("Generating compile_commands.json...", flush=True) subprocess.run( [ bazel,