This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Get rid of Inclusion::R
ClosedPublic

Authored by kadircet on May 4 2020, 1:53 AM.

Details

Summary

This is only used by documentlink and go-to-definition. We are pushing
range detection logic from Inclusion creation to users. This would make using
stale preambles easier.

For document links we make use of the spelledtokens stored in tokenbuffers to
figure out file name range.

For go-to-def, we keep storing the line number we've seen the include directive.

Diff Detail

Event Timeline

kadircet created this revision.May 4 2020, 1:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2020, 1:53 AM
sammccall accepted this revision.May 4 2020, 6:55 AM
sammccall added inline comments.
clang-tools-extra/clangd/Headers.cpp
45

I'm not sure what this comment is trying to tell me - is it just "the next line isn't very expensive"? I wouldn't bother in that case...

clang-tools-extra/clangd/XRefs.cpp
610

is this just FileTok.range(SM)?

clang-tools-extra/clangd/unittests/XRefsTests.cpp
1493

can you try an angled include too? Does the raw lexer get that right?

This revision is now accepted and ready to land.May 4 2020, 6:55 AM
kadircet marked 4 inline comments as done.May 4 2020, 9:16 AM
kadircet added inline comments.
clang-tools-extra/clangd/XRefs.cpp
610

unfortunately it is not. as raw lexing doesn't parse angled filename tokens(it will just point to the lessthan token). Adding a comment.

kadircet updated this revision to Diff 261845.May 4 2020, 9:16 AM
kadircet marked an inline comment as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.