sammccall added inline comments.
================ Comment at: clang-tools-extra/clangd/XRefs.cpp:367 + auto Tokens = syntax::spelledTokensTouching(Loc, AST.getTokens()); + if (Tokens.size() != 1) + return {}; ---------------- this means you're not going to resolve `foo` in `a.^foo` (you're touching two tokens). The cleanest thing seems to be to use the word you've identified: iterate over the `spelledTokensTouching(WordStart)` and accept the one where `tok.range(SM).touches(WordOffset + Word.size())` ================ Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:343 SrcBuffer.data() + SrcBuffer.size()); + L.SetCommentRetentionState(true); ---------------- Yikes, I didn't remember TokenBuffer doesn't currently record comment tokens. I'm afraid this isn't a trivial change and would definitely need tests to verify it doesn't interfere with translating between spelled/expanded tokens (I'm pretty sure there are tests that comments *aren't* retained now in TokensTest.cpp, part of SyntaxTests) Given that, the shorter route for this patch would be to blacklist string literals rather than whitelisting comments + identifiers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76098/new/ https://reviews.llvm.org/D76098 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits