Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| clangd/XRefs.cpp | ||
|---|---|---|
| 724 ↗ | (On Diff #181481) | nit: move this to the top, since it's just adjusting input params? |
| 730 ↗ | (On Diff #181481) | I don't think we need to break up the flow here to early exit. I'd suggest reducing the number of places we deal with limits, we can get away with 3 instead of 5: ... collect results as before ...
if (Index && Limit && Results.size() < Limit) {
... query index ...
Req.Limit = Limit;
... append results as usual ...
}
if (Limit && Results.size() > Limit)
Results.resize(limit) |
| clangd/index/MemIndex.cpp | ||
| 72 ↗ | (On Diff #181481) | Req.Limit.getValueOr(...) |
| 72 ↗ | (On Diff #181481) | if you're going to mutate this, maybe call it "remaining" or so? |
| clangd/index/Merge.cpp | ||
| 98 ↗ | (On Diff #181481) | why two separate count variables? |
| 98 ↗ | (On Diff #181481) | you've inserted the new code between existing code and the comment that describes it. |
| unittests/clangd/DexTests.cpp | ||
| 673 ↗ | (On Diff #181481) | If you want these to be the same test, there should be some connection between them. |
| 686 ↗ | (On Diff #181481) | As far as I can tell, this limit makes no difference, there's only one result anyway. |
| 691 ↗ | (On Diff #181481) | In tests, we know what the number is, and it's clearer to just spell it out: EXPECT_EQ(1, RefCount) |
| 691 ↗ | (On Diff #181481) | generally prefer to use EXPECT_THAT only with matchers. EXPECT_EQ gives clearer error messages, reads more naturally, and is more common. Better still would be to assert the actual outcomes, e.g. ElementsAre(anyOf("foo1.h", "foo2.h")) |
| unittests/clangd/IndexTests.cpp | ||
| 306 ↗ | (On Diff #181481) | why new scope here? |
| unittests/clangd/DexTests.cpp | ||
|---|---|---|
| 673 ↗ | (On Diff #181481) | Done, made the query request the same in this test except the limit. |
| 686 ↗ | (On Diff #181481) | Actually, the filter of the request was different than the case above, we would get 2 refs. Used the same request to avoid confusion. |
| unittests/clangd/IndexTests.cpp | ||
| 306 ↗ | (On Diff #181481) | To align with the case above. |
| unittests/clangd/DexTests.cpp | ||
|---|---|---|
| 684 ↗ | (On Diff #181543) | instead of splitting scopes here, might be more obvious just to Files.clear() between? |
| unittests/clangd/IndexTests.cpp | ||
| 306 ↗ | (On Diff #181481) | FWIW I'd find it easier to read if neither this nor the one above used new scopes, which tend to suggest some spooky scoped object side effects to me. |