[clangd] Adjust compile commands to be applicable for tooling
authorKadir Cetinkaya <kadircet@google.com>
Fri, 8 Mar 2019 08:38:25 +0000 (08:38 +0000)
committerKadir Cetinkaya <kadircet@google.com>
Fri, 8 Mar 2019 08:38:25 +0000 (08:38 +0000)
commit65944ab50d650e4fde6eb008835644c9c9770e90
tree39606b9e3d44fba0b4376ab4faf067953c021347
parente7eb27a9a0edd859de49bcc9af7ca27dbb435886
[clangd] Adjust compile commands to be applicable for tooling

Summary:
As can be seen in https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Tooling.cpp#L385
clang tool invocations adjust commands normally like this. In clangd we have
different code paths for invoking a frontend action(preamble builds, ast builds,
background index, clangd-indexer) they all work on the same GlobalCompilationDatabase
abstraction, but later on are subject to different modifications.

This patch makes sure all of the clangd actions make use of the same compile
commands before invocation.

Enables background-index to work on chromium codebase(since they had dependency
file output in their compile commands).

Reviewers: gribozavr, hokein

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59086

llvm-svn: 355669
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/unittests/clangd/GlobalCompilationDatabaseTests.cpp