This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Allow the client to specify multiple compilation databases in the 'initialize' request
Needs ReviewPublic

Authored by nridge on Aug 1 2019, 5:59 PM.

Details

Reviewers
ilya-biryukov
Summary

This is useful for multi-project setups where each project has its own
compilation database, and particularly in cases where such databases
are located outside of the respective source directories (for example,
in build directories).

Diff Detail

Event Timeline

nridge created this revision.Aug 1 2019, 5:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2019, 5:59 PM
nridge added a comment.Aug 1 2019, 6:00 PM

As background, some discussion of this took place on the mailing list a few months ago: http://lists.llvm.org/pipermail/clangd-dev/2019-January/000232.html

Could this be handled outside clangd? If not, what are the complications?

We currently have a capability to specify a path to a single compile_commands.json.
I would expect clients using this extension (Theia?) also handle generation of compile_commands.json. If that's the case, could they merge multiple compile_commands.json files into one and ask clangd to load it using APIs we have today?

nridge added a comment.Aug 3 2019, 4:53 PM

Thanks for having a look! I filed an issue so some folks who don't necessarily have an LLVM Phabricator account can weigh in, let's continue the discussion there.

Ilya / others if interested, I would like to revive this patch.

We left off with a discussion in the corresponding issue, where I made a suggestion for an initial way forward. Could I get some feedback on that please?

Unit tests: fail. 62144 tests passed, 5 failed and 811 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: fail. clang-tidy found 2 errors and 4 warnings. 4 of them are added as review comments below (why?).

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.