[PATCH] D146727: [clangd] Use expansion location for missing include diagnostics.
Viktoriia Bakalova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 27 06:09:31 PDT 2023
VitaNuo marked an inline comment as done.
VitaNuo added inline comments.
================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:380
+ auto Loc = SM.getFileLoc(Ref.RefLocation);
+ auto Range = Lexer::makeFileCharRange(
+ CharSourceRange{SourceRange{Loc}, true}, SM, AST.getLangOpts());
----------------
kadircet wrote:
> I don't think you need to re-lex the token here, as `Loc` is already a non-macro location in main file, you can still use `Tokens.spelledTokenAt(Loc)`. Am i missing something?
It's for consistency with clangd diagnostic generation [here](http://google3/third_party/llvm/llvm-project/clang-tools-extra/clangd/Diagnostics.cpp;l=114;rcl=512058308) (according to Sam), but both should work.
Would you rather prefer `Tokens.spelledTokenAt(Loc)`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146727/new/
https://reviews.llvm.org/D146727
More information about the cfe-commits
mailing list