[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 6 06:27:43 PDT 2024
================
@@ -1354,6 +1354,8 @@ maybeFindIncludeReferences(ParsedAST &AST, Position Pos,
ReferencesResult::Reference Result;
const auto *Token = AST.getTokens().spelledTokenAt(Loc);
+ if (!Token)
----------------
kadircet wrote:
thanks! can you also rename `spelledTokenAt` to `spelledTokenCotaining` and update the comment and change the null-check here to an assertion?
also, what's the conclusion of investigation around `don't really rely on spelledTokenAt failing when it's called with a random offset into the token`?
https://github.com/llvm/llvm-project/pull/94528
More information about the cfe-commits
mailing list