[clangd] Allow consuming limited number of items
authorKirill Bobyrev <kbobyrev.opensource@gmail.com>
Fri, 10 Aug 2018 11:50:44 +0000 (11:50 +0000)
committerKirill Bobyrev <kbobyrev.opensource@gmail.com>
Fri, 10 Aug 2018 11:50:44 +0000 (11:50 +0000)
commit0a75766c3d851b3a792eadbcf28a44ffc8b956fd
tree056262866978a18c4e7c62b9f8a6c3d26067566f
parent130b00bc43bc6796cec409f64bc499cefc420801
[clangd] Allow consuming limited number of items

This patch modifies `consume` function to allow retrieval of limited
number of symbols. This is the "cheap" implementation of top-level
limiting iterator. In the future we would like to have a complete limit
iterator implementation to insert it into the query subtrees, but in the
meantime this version would be enough for a fully-functional
proof-of-concept Dex implementation.

Reviewers: ioeric, ilya-biryukov

Reviewed by: ioeric

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

llvm-svn: 339426
clang-tools-extra/clangd/index/dex/Iterator.cpp
clang-tools-extra/clangd/index/dex/Iterator.h
clang-tools-extra/unittests/clangd/DexIndexTests.cpp