[all-commits] [llvm/llvm-project] 6c1dbd: [clang] NFC: Remove `{File, Directory}Entry::getNam...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed Jan 24 08:41:27 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c1dbd5359c4336d03b11faeaea8459b421f2c5c
      https://github.com/llvm/llvm-project/commit/6c1dbd5359c4336d03b11faeaea8459b421f2c5c
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M clang/include/clang/Basic/DirectoryEntry.h
    M clang/include/clang/Basic/FileEntry.h
    M clang/lib/Basic/FileManager.cpp
    M clang/unittests/Basic/FileManagerTest.cpp
    M llvm/include/llvm/Support/VirtualFileSystem.h
    M llvm/lib/Support/VirtualFileSystem.cpp
    M llvm/unittests/Support/VirtualFileSystemTest.cpp

  Log Message:
  -----------
  [clang] NFC: Remove `{File,Directory}Entry::getName()` (#74910)

The files and directories that Clang accesses are uniqued by their
inode. For each inode `FileManager` will create exactly one `FileEntry`
or `DirectoryEntry` object, which makes answering the question _"Are
these two files/directories the same?"_ a simple pointer equality check.

However, since the same inode can be accessed through multiple different
paths, asking the `FileEntry` or `DirectoryEntry` object _"What is your
name?"_ doesn't have clear semantics. In c0ff9908 we started reporting
the most recent name used to access the entry, which turned out to be
necessary for Clang modules. However, the long-term solution has always
been to explicitly track the as-requested name. This has been
implemented in 4dc5573a as `FileEntryRef` and `DirectoryEntryRef`.

The `DirectoryEntry::getName()` interface has been deprecated since the
Clang 17 release and `FileEntry::getName()` since Clang 18. We have
replaced uses of these deprecated APIs in `main` with
`DirectoryEntryRef::getName()` and `FileEntryRef::getName()`
respectively.

This makes it possible to remove `{File,Directory}Entry::getName()` for
good along with the `FileManager` code that implements them.




More information about the All-commits mailing list