[PATCH] D50500: [clangd] Allow consuming limited number of items
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 9 06:31:33 PDT 2018
ioeric added a comment.
Could you add test? ;)
================
Comment at: clang-tools-extra/clangd/index/dex/Iterator.cpp:223
std::vector<DocID> Result;
- for (; !It.reachedEnd(); It.advance())
+ for (size_t Retreived = 0; !It.reachedEnd() && Retreived < Limit;
+ It.advance())
----------------
Where do we increment `Retrieved`?
================
Comment at: clang-tools-extra/clangd/index/dex/Iterator.cpp:223
std::vector<DocID> Result;
- for (; !It.reachedEnd(); It.advance())
+ for (size_t Retreived = 0; !It.reachedEnd() && Retreived < Limit;
+ It.advance())
----------------
ioeric wrote:
> Where do we increment `Retrieved`?
nit: `s/Retreived/Retrieved/`
================
Comment at: clang-tools-extra/clangd/index/dex/Iterator.h:108
+/// for the number of elements obtained before the iterator is exhausted.
+std::vector<DocID> consume(Iterator &It,
+ size_t Limit = std::numeric_limits<size_t>::max());
----------------
nit: I think `Size of the returned ...` is just repeating the first two sentences. Maybe drop?
https://reviews.llvm.org/D50500
More information about the cfe-commits
mailing list