diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2024-01-24 17:41:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 08:41:14 -0800 |
commit | 6c1dbd5359c4336d03b11faeaea8459b421f2c5c (patch) | |
tree | 8fd263dfe71430a2438196751fb3bcf0ec8305d9 /clang/unittests/Basic/FileManagerTest.cpp | |
parent | 56444d5687818938a6ce798e7221aa920c54098e (diff) | |
download | llvm-6c1dbd5359c4336d03b11faeaea8459b421f2c5c.zip llvm-6c1dbd5359c4336d03b11faeaea8459b421f2c5c.tar.gz llvm-6c1dbd5359c4336d03b11faeaea8459b421f2c5c.tar.bz2 |
[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.
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index 4333967..d32036d 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -284,9 +284,6 @@ TEST_F(FileManagerTest, getFileRefReturnsCorrectNameForDifferentStatPath) { ASSERT_FALSE(!F1Alias); ASSERT_FALSE(!F1Alias2); EXPECT_EQ("dir/f1.cpp", F1->getName()); - LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH - EXPECT_EQ("dir/f1.cpp", F1->getFileEntry().getName()); - LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP EXPECT_EQ("dir/f1.cpp", F1Alias->getName()); EXPECT_EQ("dir/f1.cpp", F1Alias2->getName()); EXPECT_EQ(&F1->getFileEntry(), &F1Alias->getFileEntry()); @@ -305,9 +302,6 @@ TEST_F(FileManagerTest, getFileRefReturnsCorrectNameForDifferentStatPath) { ASSERT_FALSE(!F2Alias); ASSERT_FALSE(!F2Alias2); EXPECT_EQ("dir/f2.cpp", F2->getName()); - LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH - EXPECT_EQ("dir/f2.cpp", F2->getFileEntry().getName()); - LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP EXPECT_EQ("dir/f2.cpp", F2Alias->getName()); EXPECT_EQ("dir/f2.cpp", F2Alias2->getName()); EXPECT_EQ(&F2->getFileEntry(), &F2Alias->getFileEntry()); |