[clangd] Dont run raw-lexer for OOB source locations
authorKadir Cetinkaya <kadircet@google.com>
Wed, 24 May 2023 12:22:43 +0000 (14:22 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Thu, 25 May 2023 07:38:04 +0000 (09:38 +0200)
commita2f7352f3e809cb1b267e769d00ea84e4ef46bf0
tree2365d706b845c8491a6a08f19978454a72b31624
parentd5c56c5162e535baec61e385f53e512adeaa2815
[clangd] Dont run raw-lexer for OOB source locations

We can get stale source locations from preamble, make sure we don't
access those locations without checking first.

Fixes https://github.com/clangd/clangd/issues/1636.

Differential Revision: https://reviews.llvm.org/D151321
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/unittests/PreambleTests.cpp