https://sarcasm.github.io/notes/dev/compilation-database.html#clang
Replace the shell script for generating the compilation database (gen_ccjs.sh) with the generator from clang++.
Specifically, use the usually clang++ compilation command, but add a -MJ flag passing along a temporary json file. Finally add [ ] to the generated file. For example:
clang++ -std=c++17 -MJ temp.json main.cc -o main
sed -e '1s/^/[\n/' -e '$s/,$/\n]/' temp.json > compile_commands.json
rm temp.json