OSDN Git Service

[clangd] Explicitly avoid background-indexing the same file twice.
authorSam McCall <sam.mccall@gmail.com>
Tue, 12 Jan 2021 16:18:35 +0000 (17:18 +0100)
committerSam McCall <sam.mccall@gmail.com>
Wed, 13 Jan 2021 16:29:30 +0000 (17:29 +0100)
commit66d5994bd38a9be4a0c05de2b69f88b64e6845ce
tree1d87dc6161f95ff483ec879af4bab0b0aad72bb2
parent4fe17ada55ade9b77e18521dae0985cb4a88f6c4
[clangd] Explicitly avoid background-indexing the same file twice.

This used to implicitly never happen due to only discovering each CDB
once.

We may want to carefully support reindexing one day, but we need to do
it carefully (tricky tradeoffs) and it would need further support in
background indexer.

Making this explicit here rather than just turning off rebroadcast in
background index for a few reasons:
- allows *new* files in the same CDB to be indexed
- relying on bugs-at-a-distance cancelling each other out is bound to bite us
- gets us closer to actually supporting reindexing, which requires similar tracking

Differential Revision: https://reviews.llvm.org/D94503
clang-tools-extra/clangd/index/Background.cpp
clang-tools-extra/clangd/index/Background.h
clang-tools-extra/clangd/index/BackgroundQueue.cpp
clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp