[clangd] Store preamble macros in dynamic index.
authorEric Liu <ioeric@google.com>
Wed, 19 Sep 2018 09:35:04 +0000 (09:35 +0000)
committerEric Liu <ioeric@google.com>
Wed, 19 Sep 2018 09:35:04 +0000 (09:35 +0000)
commit467c5f9ce0221bded904470cae2b48dd84c6b7ae
tree45fc2067b5bcc2ecc07651ce340d30f23fef1fd9
parent88de9f6579f2d79428eb51d6389f4d8c592a7e38
[clangd] Store preamble macros in dynamic index.

Summary:
Pros:
o Loading macros from preamble for every completion is slow (see profile).
o Calculating macro USR is also slow (see profile).
o Sema can provide a lot of macro completion results (e.g. when filter is empty,
60k for some large TUs!).

Cons:
o Slight memory increase in dynamic index (~1%).
o Some extra work during preamble build (should be fine as preamble build and
indexAST is way slower).

Before:
{F7195645}

After:
{F7195646}

Reviewers: ilya-biryukov, sammccall

Reviewed By: sammccall

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 342529
clang-tools-extra/clangd/index/FileIndex.cpp
clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp
clang-tools-extra/unittests/clangd/FileIndexTests.cpp