[clang-tools-extra] [clangd] Correctly identify the next token after the completion point (PR #69153)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 03:39:39 PST 2023


https://github.com/zyn0217 approved this pull request.

I'd like to approve the patch boldly since the findTokenAfterCompletionPoint is mostly duplicated from `Lexer::findNextToken` except for a difference that our version calls `Loc.getLocWithOffset(1)` rather than MeasureTokenLength() for the next token's location.

I have also tried another approach similar to Nathan's, in which I have constructed a lexer from the current location (i.e. the completion point) as well as the preprocessor. It looks as complicated as this way, and I don't think that is more optimal. (Or should I conclude that this is the best option?)

https://github.com/llvm/llvm-project/pull/69153


More information about the cfe-commits mailing list