This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Use Dirty Filesystem for cross file rename.
ClosedPublic

Authored by njames93 on Jan 20 2021, 6:22 AM.

Details

Summary

Refactor cross file rename to use a Filesystem instead of a function for getting buffer contents of open files.

Depends on D94554

Diff Detail

Event Timeline

njames93 created this revision.Jan 20 2021, 6:22 AM
njames93 requested review of this revision.Jan 20 2021, 6:22 AM
njames93 updated this revision to Diff 323379.Feb 12 2021, 10:01 AM

Rebase and fix up tests after changes to rename.

njames93 updated this revision to Diff 329126.Mar 8 2021, 1:34 PM

Rebase and remove an addressed FIXME.

sammccall accepted this revision.Mar 9 2021, 12:21 AM

This looks pretty good, great cleanup!

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

we shouldn't need to pass a nontrivial FS in here, right?

clang-tools-extra/clangd/refactor/Rename.h
40

Index + FS are both only used for cross-file renames at this point.

(We used to support a single-file rename mode where the index was used to validate that the symbol wasn't used elsewhere, but that's gone now)

I think we should document this, and assert that they're either both set (cross-file) or neither is.

This revision is now accepted and ready to land.Mar 9 2021, 12:21 AM
njames93 added inline comments.Mar 9 2021, 1:51 AM
clang-tools-extra/clangd/refactor/Rename.h
40

I wasn't sure the best way to approach this, but i agree, this is probably the safest.

kadircet added inline comments.Mar 9 2021, 2:42 AM
clang-tools-extra/clangd/ClangdServer.cpp
495

i think this makes sense, as the idea is try to keep it fast by shying away from copying over all the dirty buffers.

njames93 marked 3 inline comments as done.Mar 9 2021, 8:33 AM
njames93 updated this revision to Diff 329354.Mar 9 2021, 8:34 AM

Update to assert that either Index and FS are both set, or neither set.
Document this behaviour.

This revision was automatically updated to reflect the committed changes.