Details
- Reviewers
sammccall - Commits
- rG3755039c99d8: [clangd] Get rid of getTokenRange helper
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
- Also get rid of the call in collectmacros by using clang::Token's endlocation instead.
clang-tools-extra/clangd/Hover.cpp | ||
---|---|---|
541 | nit: back() would fit better with the biases elsewhere | |
clang-tools-extra/clangd/XRefs.cpp | ||
157–158 | so this is just running the raw lexer... both callers have a ParsedAST, can we call spelledTokenAt()? Either here, passing in (TokenBuffer, Loc, TUPath) or in the caller, passing in (syntax::Token*, SourceMgr, TUPath). | |
157–158 | It *seems* to always be the case that TokLoc is a spelled token, but this seems slightly subtle and the previous code defended against marco locations. Worth a comment | |
379 | document spelled or expanded. It seems to be spelled, but I don't know why - expanded is more similar to the old code, allows us to defer more work, and doesn't require the dubious front(). You could add a function here range(SourceMgr) --> Range | |
425 | why is it safe to discard the rest of toks? |
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
157–158 |
as you pointed out offline, we only have spelled tokens for the main file. |
- Use getFileLoc instead of spelledForExpanded
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
157–158 |
as discussed offline the problem is TokenBuffer won't hold spelled tokens for included files. so if you've got a macro definition or declaration coming from a header, spelledTokenAt will fail. | |
157–158 | as discussed offline, in case of macro locations we'll fail at getting the file path and stop there and that logic is the same. |
nit: back() would fit better with the biases elsewhere