[PATCH] D118322: [clangd] Fix a selection tree crash for unmatched-bracket code.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 27 00:01:13 PST 2022


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Wow, nice find!

I'd argue the bug is probably rather in `TokenBuffer::expandedTokens(SourceRange)` that produced this span. The idea that it might *rarely* include the EOF token seems like a magnet for bugs like these.

(Of course it's a special case of a more general "recovery location points at an unrelated token" problem)...

Even if we want to fix it in TokenBuffer, doing it right before the release cut might be risky. So:

- fix it here
- or fix it in TokenBuffer
- or fix it here and then change after the branch cut

I'm happy with any of these options, up to you.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118322/new/

https://reviews.llvm.org/D118322



More information about the cfe-commits mailing list