Skip to content

Multiple command objects for the same file #2004

Answered by HighCommander4
abdelmaged asked this question in Q&A
Discussion options

You must be logged in to vote
  1. How does clangd handle this situation ?

It will use an unspecified one of the available commands for the file (likely the first one it encounters).

  1. How to tell clangd to dynamically pick specific command object for file.c, like pick the command with -Dexe2 instead of -Dexe1 ?

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.

  1. Is it possible that clangd can merge all command objects into single view ?

It's not clear what merging would mean here.

I can imagine merging the commands, such that you get a command containing both -Dexe1

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@i-ky
Comment options

Answer selected by abdelmaged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants