[PATCH] D148663: [RFC][clangd] Use interpolation for CDB pushed via LSP protocol

Dmitry Polukhin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 03:42:52 PDT 2023


DmitryPolukhin added a comment.

In D148663#4298496 <https://reviews.llvm.org/D148663#4298496>, @ilya-biryukov wrote:

> I wanted to chime in and provide a bit of context.
> This was a long time ago, so I might misremember, so take this with a grain of salt.
>
> Idea behind pushing the CDB over LSP was to allow the capable client to **fully** control the commands produced for the files.
> Decisions like interpolation were pushed towards the clients intentionally, not accidentally.
> IIRC, the motivation back in the day was either sourcekit-lsp or Theia.
>
> I will let other do the actual review, just wanted to bring up the history for a complete picutre.

Thank you for sharing the context. I completely agree with the idea that nothing should prevent clangd clients from fully controlling CDB if they want it.
And, if they do so, this diff will just does nothing because there is an exact match. It starts playing only if client provided partial CDB and inference is required.
So I think it shouldn't break any existing scenarios. But IMHO having inference is a good feature for clangd because it allows pushing exactly the same CDB as in
compile_commands.json file and re-using clangd logic how to transfer compile commands from source to header. Pushing command via LSP might be preferable
in comparison with file based approach to avoid race condition with updating the file and clangd reading it + it works better with build systems that can generate
compiles commands on the fly for files and generating all of them in advance may not be possible.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148663/new/

https://reviews.llvm.org/D148663



More information about the cfe-commits mailing list