https://github.com/HighCommander4 requested changes to this pull request.

Thanks for adding some unit tests, and sorry I didn't get a chance to look at 
this sooner.

Unfortunately, it looks like the patch needs a bit more work, as I'm seeing it 
crash on incomplete code, for example:

```c++
#ifdef WALDO

#
```

This crashes, at least on an assertions-enabled build, with:

> include/llvm/ADT/ArrayRef.h:454: T 
> &llvm::MutableArrayRef<clang::clangd::Token>::operator[](size_t) const [T = 
> clang::clangd::Token]: Assertion `Index < this->size() && "Invalid index!"' 
> failed.

That will need to be investigated and fixed before this patch can land. (Note 
that operations like folding ranges need to be robust and not crash on invalid 
code, especially on invalid code that is a plausible intermediate product of 
writing valid code, as in the above example, because the editor can potentially 
ask clangd to compute folding ranges after every keystroke.)

(As part of fixing this assertion failure, please include a unit test for the 
crashing testcase as well.)

https://github.com/llvm/llvm-project/pull/140959
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to