Questions tagged [compilation-database]

For questions devoted to exporting, rendering, or analyzing compilation database artifacts.

A compilation database is a database for compile options. It records which compile options are used to build the files in a project. A compilation database can be, but is not limited to, a JSON Compilation Database.
https://sarcasm.github.io/notes/dev/compilation-database.html#what-is-a-compilation-database


> A compilation database is a JSON file, which consists of an array of “command objects”, where each command object specifies one way a translation unit is compiled in the project. > > Each command object contains the translation unit’s main file, the working directory of the compile run and the actual compile command. > https://clang.llvm.org/docs/JSONCompilationDatabase.html#format
6 questions
60
votes
7 answers

How to turn makefile into JSON Compilation Database?

Say we have make files (not cmake/premake/ninja etc) for our project that do work for gcc and clang. We want to generate out from them JSON Compilation Database to feed it into clang-modernize tool. How to do such thing? (is there any parser in…
DuckQueen
  • 772
  • 10
  • 62
  • 134
2
votes
1 answer

How to obtain the compilation command in a tool based on libtooling

I have built a custom tool (based on libtooling) for transforming source code. I used clang's own tutorial and managed to run my own custom FrontendAction. I now need to parse the compile flags that were provided to the tool (on the command line) to…
Ethan
  • 57
  • 4
1
vote
1 answer

clangd does not find `compile_commands.json` automatically

Setup I'm using clangd through neovim with nvim-lspconfig. require('lspconfig').clangd.setup { -- on_attach = keybinds.on_attach, cmd = { "clangd", "--background-index", "--suggest-missing-includes", --…
Olli
  • 375
  • 5
  • 15
1
vote
0 answers

Is it possible to generate build.ninja for Linux kernel?

I have been using ninja build for some projects. And it is very convenient to generate a compilation database file with ninja -t compdb. This file can be used in Visual Studio Code for accurate symbol resolution. So is it possible to generate a…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
1
vote
0 answers

How can I clean up compiler-file*.d in IntelliJ CLion?

I created a compilation database for a large C project in IntelliJ CLion. So far it's been working well, but my directories are filling up with compiler-file*.d files. Is there a way to clean them up?
Dean Schulze
  • 9,633
  • 24
  • 100
  • 165
0
votes
0 answers

How to use compilation-database for build?

I find tons of descriptions how to generate a compilation database (especially compile_commands.json) for a C/C++ project. But the other way round: how to use it as input for a build via make or similar from command line?