kbobyrev added inline comments.

================
Comment at: clang-tools-extra/clangd/index/dex/Iterator.cpp:248
+    assert(!reachedEnd() && "Can't advance iterator after it reached the 
end.");
+    Index = ID;
+  }
----------------
ioeric wrote:
> Should we check `ID < Size` here?
Not really, here's an example: `(& ({0}, 42) (TRUE {0} out of 10)`.

When called `advance()`, underlying AND iterator would point to `42` and 
`advanceTo()` would be called on TRUE iterator, it will move it to the END but 
it would be completely valid (same behavior for every iterator, actually, since 
none of them check for `ID < LastDocID` equivalent).

I should, however, do `Index = std::min(ID, Size)` since calling `dump()` and 
getting something like `(TRUE {9000} out of 42)` would be implicit.


https://reviews.llvm.org/D50955



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to