This script slices up a compile_commands.json into multiple json files, and runs lsif-clang separately for each file.
# Fail fast (exit after first error), prints Clang error output and reproduction information
./utils/lsif-clang-driver.py /path/to/lsif-clang /path/to/compile_commands.json
Found lsif-clang failure (stdout+stderr below):
--------------------------------------------------------------
[1/1] Processing file /Users/varun/Code/lsif-clang/clang-tools-extra/clangd/FS.cpp
In file included from /Users/varun/Code/lsif-clang/clang-tools-extra/clangd/FS.cpp:9:
<snipped>
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/wchar.h:89:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
^~~~~~~~~~
1 error generated.
Error while processing /Users/varun/Code/lsif-clang/clang-tools-extra/clangd/FS.cpp.
--------------------------------------------------------------
Reproduce the failure by running:
/Users/varun/Code/lsif-clang/bin/lsif-clang /var/folders/tr/gylnxkts3bn0gyhhlrv8z9_m0000gn/T/tmps5sae_qm-repro/compile_commands.json
# Don't fail fast, printing all output and showing the number of errors at the end
./utils/lsif-clang-driver.py /path/to/lsif-clang /path/to/compile_commands.json --no-fail-fast
<snipped>
Reproduce the failure by running:
/Users/varun/Code/lsif-clang/bin/lsif-clang /var/folders/tr/gylnxkts3bn0gyhhlrv8z9_m0000gn/T/tmpb30_2b8a-repro/compile_commands.json
30/31 lsif-clang commands failed. 😭
There are also other flags to suppress the Clang output (the reproduction instructions will still be printed) and to control the level of concurrency (defaults to number of CPUs). (See --help.)
This script slices up a
compile_commands.json
into multiple json files, and runslsif-clang
separately for each file.There are also other flags to suppress the Clang output (the reproduction instructions will still be printed) and to control the level of concurrency (defaults to number of CPUs). (See
--help
.)Test plan
Manually tested.