Skip to content

hxdnshx/lsif-cpp

 
 

Repository files navigation

C/C++ LSIF indexer

Visit https://lsif.dev/ to learn about LSIF.

Installation

Required tools:

  • Node.js
  • Yarn
  • make
  • A C++ compiler with LLVM dev headers (versions 3 through 9 are supported)

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

Build the C++ compiler plugin and the LSIF conversion tool:

git clone https://github.com/sourcegraph/lsif-cpp
cd lsif-cpp
./build

Indexing your repository

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 will cd 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 to ABSOUTDIR by the generate-csv command
  • --root: the path to ABSROOTDIR
  • --out: the path where the LSIF dump will be written

About

Language Server Index Format (LSIF) generator for C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 67.4%
  • TypeScript 29.5%
  • Shell 2.0%
  • Other 1.1%