[PATCH] D74844: [clangd] Get rid of Lexer usage in CodeComplete
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 05:01:46 PST 2020
kadircet marked an inline comment as done.
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:593
+ llvm::StringRef SpelledSpecifier =
+ syntax::FileRange(CCSema.SourceMgr, SemaSpecifier->getBeginLoc(),
+ SemaSpecifier->getEndLoc())
----------------
sammccall wrote:
> what if beginLoc and endLoc are in different files?
> (this is most of what Lexer deals with, I think)
>
> I think you want TokenBuffer::expandedTokens(SourceRange), then spelledForExpanded, and then FileRange(...).text().
right, thinking about it again, I suppose it is better to keep lexer here as there's syntax::FileRange doesn't support macroIDs.
We would need to handle it ourselves in here which wouldn't reduce technical debt at all.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74844/new/
https://reviews.llvm.org/D74844
More information about the cfe-commits
mailing list