Multiple command objects for the same file #2004
-
I'm using clangd in vscode, and I'm working on a project where it's very common to compile the same file for different executables with different defines, i.e. if I have two executables And
This produces compile_commands.json like:
We have one file
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It will use an unspecified one of the available commands for the file (likely the first one it encounters).
There isn't currently a way to do this. One thing I have seen people do is perform a post-processing step on the
It's not clear what merging would mean here. I can imagine merging the commands, such that you get a command containing both #ifdef exe1
int var = 42;
#elif exe2
int var = 43; // same variable name
#endif If this is compiled with both |
Beta Was this translation helpful? Give feedback.
It will use an unspecified one of the available commands for the file (likely the first one it encounters).
There isn't currently a way to do this.
One thing I have seen people do is perform a post-processing step on the
compile_commands.json
to filter out some entries. jq can be a helpful tool for this job.It's not clear what merging would mean here.
I can imagine merging the commands, such that you get a command containing both
-Dexe1
…