This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Use FileEntryRef for canonicalizing filepaths.
ClosedPublic

Authored by usaxena95 on Apr 13 2023, 3:49 AM.

Details

Summary

Using FileEntry for retrieving filenames give the name used for the last access. FileEntryRef gives the first access name.

Last access name is suspected to change with unrelated changes in clang or the underlying filesystem. First access name gives more stability to the name and makes it easier to track.

Diff Detail

Event Timeline

usaxena95 created this revision.Apr 13 2023, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 3:49 AM
usaxena95 requested review of this revision.Apr 13 2023, 3:49 AM
usaxena95 updated this revision to Diff 513165.Apr 13 2023, 4:04 AM

More refactorings.

usaxena95 edited the summary of this revision. (Show Details)Apr 13 2023, 5:01 AM
usaxena95 added a reviewer: kadircet.

we've got one more reference to getCanonicalPath in clang-tools-extra/clangd/IncludeCleaner.cpp:320, i guess the best way is just calling getLastRef on the FileEntry*

clang-tools-extra/clangd/SourceCode.cpp
517–518

we don't need this check anymore

clang-tools-extra/clangd/SourceCode.h
166

just FileEntryRef, it's a cheap value type that provides an immutable view into underlying FileEntry

clang-tools-extra/clangd/index/SymbolCollector.cpp
208

again just FileEntryRef

395

FileEntryRef should be implicitly convertable to FileEntry* (so just *FE should be enough?)

399

same as above

401

same as above

usaxena95 updated this revision to Diff 513219.Apr 13 2023, 6:53 AM
usaxena95 marked 6 inline comments as done.

Addressed comments.

kadircet accepted this revision.Apr 13 2023, 7:43 AM

thanks!

This revision is now accepted and ready to land.Apr 13 2023, 7:43 AM
This revision was automatically updated to reflect the committed changes.