[clangd-dev] compile_commands.json for an unusual file structure

Dovod Dovodov via clangd-dev clangd-dev at lists.llvm.org
Tue May 28 01:20:32 PDT 2019


Hi Mikael,

I guess you should also fix "command" part in order to make clangd work
with fine. So apart from fixing "file" you should replace *_package.cpp and
*package.cpp.o entries in the "command" arguments with needed .cpp file
paths. Just checked it, with improper "command" with clangd + emacs + lsp
on macos I have no code completion.


On Tue, 28 May 2019 at 11:00, Mikael Springer via clangd-dev <
clangd-dev at lists.llvm.org> wrote:

> Hi.
>
> We have our code structured in a somewhat unusual way. All *.cpp source
> files are included (#include …) in a number of *_package.cpp files. These
> *_package.cpp files are the ones configured in a Xcode project and in a
> Visual Studio project. The primary reason for this organization is to
> minimise the need to update Xcode and Visual Studio projects when adding
> new source files to the project (one just includes the new file in a
> suitable *_package.cpp file which is already a part of the project).
>
> A consequence of this is that only the *_package.cpp files are visible in
> the compilation output. When we generate a compile_commands.json (using
> xcpretty since I’m on MacOS and using Xcode) this compilation database only
> contains entries for the *_package.cpp files. If I want to use for example
> Emacs and LSP this doesn’t work since a large part of the code base is not
> in the compilation database.
>
> Would it be possible to add entries for each cpp source file that is
> included in the *_package.cpp files to the compile_commands.json (using a
> script). Would Clangd be able to parse this correctly? The idea is to copy
> the corresponding *_package.cpp entry in which the source file is included
> and alter the “file” part of the entry to refer to the source file instead,
> but leave the “command” part intact. This makes sense in a way since this
> is the way the source file is compiled even if it doesn’t show. Can Clangd
> work with this input?
>
> Regards, Micke.
>
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190528/3d871b71/attachment.html>


More information about the clangd-dev mailing list