[clangd] Improve the `--skip-preamble-build` option
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
As discussed in the conversation starting [here](https://github.com/llvm/llvm-project/pull/211990#discussion_r3649630743), the `--skip-preamble-build` option added in clangd 23 is not very useful in its current form.
* Regardless of the option value, clangd skips its preamble build for translation units that use modules.
* The only thing the option allows doing is, by setting it to `true`, **also** skipping the preamble build for translation units that don't use modules. This is not useful / there is no motivation for this.
Rather, what would be useful, especially for modules developers who want to debug interactions between PCH and modules, is a way to opt into **enabling** preamble builds for translation units that use modules.
A specific proposal:
* Rename `--skip-preamble-build` to `--skip-preamble-build-for-modules` for clarity. Make its default value `true`.
* Allow setting it to `false` to opt into using preamble builds for modules.
Contributor guide
Research direction
Start with the linked pull-request discussion and trace clangd's --skip-preamble-build option. Verify current behavior for module and non-module translation units, then confirm the renamed option defaults to true and that setting it to false enables preamble builds for modules.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli, compilers, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100