Visit https://lsif.dev/ to learn about LSIF.
Required tools:
macOS
brew install git node llvm@8
npm i -g yarn
Ubuntu 18.04
apt-get update && apt-get install -y git nodejs npm clang libclang-dev llvm
npm i -g yarn
git clone https://github.com/sourcegraph/lsif-cpp
cd lsif-cpp
./build
Compile a C/C++ project with the instrumented compiler to generate intermediate CSV output:
env \
CLEAN=true \
ABSROOTDIR=$PWD/examples/cross-app/root \
ABSOUTDIR=$PWD/examples/cross-app/output \
<path to lsif-cpp>/generate-csv "\$CXX -c *.cpp"
ABSROOTDIR
: the absolute path to your project directory (the script willcd
here before running the compilation command)ABSOUTDIR
: the absolute path to the directory where the generated CSV files will be written
Convert those CSV files into LSIF:
node \
<path to lsif-cpp>/out/main.js \
--csvFileGlob="examples/cross-app/output/*.csv" \
--root=examples/cross-app/root \
--out examples/cross-app/root/dump.lsif
--csvFileGlob
: the wildcard pattern that matches all CSV files written toABSOUTDIR
by thegenerate-csv
command--root
: the path toABSROOTDIR
--out
: the path where the LSIF dump will be written