[clangd] Allow consuming limited number of items
ClosedPublic

Authored by kbobyrev on Thu, Aug 9, 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

Repository
rL LLVM
kbobyrev created this revision.Thu, Aug 9, 2:43 AM
ioeric added a comment.Thu, Aug 9, 6:31 AM

Could you add test? ;)

clang-tools-extra/clangd/index/dex/Iterator.cpp
223 ↗(On Diff #159885)

Where do we increment Retrieved?

223 ↗(On Diff #159885)

nit: s/Retreived/Retrieved/

clang-tools-extra/clangd/index/dex/Iterator.h
108 ↗(On Diff #159885)

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

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

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

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

Fix the implementation and add test coverage.

ioeric accepted this revision.Fri, Aug 10, 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.Fri, Aug 10, 1:52 AM
kbobyrev updated this revision to Diff 160088.Fri, Aug 10, 4:47 AM
kbobyrev marked 2 inline comments as done.
This revision was automatically updated to reflect the committed changes.