Generate compile_commands.json #4

Closed
opened 2026-07-27 12:37:46 -04:00 by kevintl1998 · 5 comments
Owner

Option to generate compile_commands.json or compile_flags.txt

Option to generate compile_commands.json or compile_flags.txt
Author
Owner

Implementing generation of these files requires a rewrite of the script since it was originally intended to generate one file.

Intended purpose of each file

  • compile_commands.json contains information about settings used to compile at a file level
  • .clangd is for diagnostic info, and global level overrides of compile_commands.json and/or compile_flags.txt
  • compile_flags.txt contains information about flags used to compile all files. In this format, the flags are always the same for all files.

Figuring out what info goes in each file

.clangd

If the passed in flags are explicitly for all files and a .clangd should be generated, then they all can be added to .clangd regardless of if we also generate a compile_commands.json.
If the passed in config data specifies file(s) for groups of flags, then there should be a key that the user puts in place of the specified file which means 'this group of flags is meant for all files' and the config data there can be placed into .clangd

compile_commands.json

If a compile_commands.json should be generated, all flags should be used to generate it.

compile_flags.txt

Similar to .clangd, any flags meant for all files should be placed in here.

Implementing generation of these files requires a rewrite of the script since it was originally intended to generate one file. ## Intended purpose of each file - compile_commands.json contains information about settings used to compile at a file level - .clangd is for diagnostic info, and global level overrides of compile_commands.json and/or compile_flags.txt - compile_flags.txt contains information about flags used to compile all files. In this format, the flags are always the same for all files. ## Figuring out what info goes in each file ### .clangd If the passed in flags are explicitly for all files and a .clangd should be generated, then they all can be added to .clangd regardless of if we also generate a compile_commands.json. If the passed in config data specifies file(s) for groups of flags, then there should be a key that the user puts in place of the specified file which means 'this group of flags is meant for all files' and the config data there can be placed into .clangd ### compile_commands.json If a compile_commands.json should be generated, all flags should be used to generate it. ### compile_flags.txt Similar to .clangd, any flags meant for all files should be placed in here.
Author
Owner

Note to self: in the generic type checker implementation, __handle_optional should check for NoneType as one of the arguments and if so, handle the arguments as if it is ‘Optional[Union[…]]’

Note to self: in the generic type checker implementation, __handle_optional should check for NoneType as one of the arguments and if so, handle the arguments as if it is ‘Optional[Union[…]]’
Author
Owner

When a specified path in "include" points at a directory, it should be assumed that all of the files contained inside (none recursive?) should also be included as well.

When a specified path in "include" points at a directory, it should be assumed that all of the files contained inside (none recursive?) should also be included as well.
Author
Owner

Verify the clangd lsp is able to find references to a function in all files.

Verify the clangd lsp is able to find references to a function in all files.
Author
Owner

Reviewed in #8

Reviewed in #8
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kevintl1998/clangd-config-gen#4
No description provided.