HomePhabricator

[clangd] findNearbyIdentifier(): fix the word search in the token stream.

Authored by ArcsinX on Jul 30 2020, 2:45 AM.

Description

[clangd] findNearbyIdentifier(): fix the word search in the token stream.

Without this patch the word occurrence search always returns the first token of the file.
Despite of that, findNeardyIdentifier() returns the correct result (but inefficently) until there are several matched tokens with the same value floor(log2(<token line> - <word line>)) (e.g. several matched tokens on the same line).

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D84912