This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Change ParseInputs to store FSProvider rather than VFS
ClosedPublic

Authored by kadircet on Jun 4 2020, 9:32 AM.

Details

Summary

This ensures ParseInputs provides a read-only access to FS.

Diff Detail

Event Timeline

kadircet created this revision.Jun 4 2020, 9:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2020, 9:32 AM

Hmm, having looked at this it is a bit of a mess, but I think partly because we're not converting *enough* code to use this abstraction (e.g. the preamble caching stuff, or prepareCompilerInstance).
We should work how how to get the bugfix part of this landed, but I think ultimately we should rename FSprovider and avoid most direct use of VFS in clangd, it bakes in this assumption about threadign that's very hard to deal with locally.

clang-tools-extra/clangd/ClangdServer.cpp
184

As a question of style, I think we should inline these wherever we're handing off a VFS to another library and we don't want to reuse it for some reason.

We can shorten the names if needed to make this nice.

clang-tools-extra/clangd/CodeComplete.cpp
1064

can we leave a fixme to propagate this change further instead?

Let's land this and do further refactoring/renames later.
As you mentioned, it's not possible to inline some of the cases where raw pointers are e.g. stored in structs due to lifetime issues. I expect many of these to go away once we use FSProvider more pervasively.

sammccall accepted this revision.Jun 8 2020, 12:45 AM
This revision is now accepted and ready to land.Jun 8 2020, 12:45 AM
kadircet updated this revision to Diff 269161.Jun 8 2020, 3:53 AM
  • Rebase
  • Move GetFSProvider to a lambda inside scanPreamble with a FIXME.
kadircet updated this revision to Diff 269168.Jun 8 2020, 4:23 AM
kadircet marked 2 inline comments as done.
  • Inline VFS uses in ClangdServer
This revision was automatically updated to reflect the committed changes.