This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Allow consuming limited number of items
ClosedPublic

Authored by kbobyrev on Aug 9 2018, 2:43 AM.

Details

Summary

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.

Diff Detail

Event Timeline

kbobyrev created this revision.Aug 9 2018, 2:43 AM
ioeric added a comment.Aug 9 2018, 6:31 AM

Could you add test? ;)

clang-tools-extra/clangd/index/dex/Iterator.cpp
223

Where do we increment Retrieved?

223

nit: s/Retreived/Retrieved/

clang-tools-extra/clangd/index/dex/Iterator.h
108

nit: I think Size of the returned ... is just repeating the first two sentences. Maybe drop?

kbobyrev planned changes to this revision.Aug 9 2018, 9:52 AM

Oops, I thought I pushed "Plan Changes" for this one.

kbobyrev updated this revision to Diff 159959.Aug 9 2018, 10:59 AM
kbobyrev marked 3 inline comments as done.

Fix the implementation and add test coverage.

ioeric accepted this revision.Aug 10 2018, 1:52 AM
ioeric added inline comments.
clang-tools-extra/unittests/clangd/DexIndexTests.cpp
252 ↗(On Diff #159959)

nit: maybe use the default parameter here?

260 ↗(On Diff #159959)

The AND iterator case doesn't seem to add more coverage. Maybe drop?

This revision is now accepted and ready to land.Aug 10 2018, 1:52 AM
kbobyrev updated this revision to Diff 160088.Aug 10 2018, 4:47 AM
kbobyrev marked 2 inline comments as done.
This revision was automatically updated to reflect the committed changes.