[clang] NFC: Deprecate FileEntry::getName() (#68157)
All uses of `FileEntry::getName()` were removed in favor of `FileEntryRef::getName()`. This patch finally formally deprecates that function. The plan is to remove it entirely in the main branch after we cut the release branch for LLVM 18.
This commit is contained in:
1 parent
9982f8ee02
commit
d1f86c3d03
3 files changed
+24
No files matched your search
@@ -394,6 +394,7 @@ class FileEntry {
|
||||
|
||||
public:
|
||||
~FileEntry();
|
||||
LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "")
|
||||
StringRef getName() const { return LastRef->getName(); }
|
||||
|
||||
StringRef tryGetRealPathName() const { return RealPathName; }
|
||||
|
||||
@@ -284,7 +284,9 @@ 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());
|
||||
@@ -303,7 +305,9 @@ 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());
|
||||
|
||||
@@ -157,6 +157,25 @@
|
||||
#define LLVM_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#elif defined(_MSC_VER)
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH \
|
||||
_Pragma("warning(push)") \
|
||||
_Pragma("warning(disable : 4996)")
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP \
|
||||
_Pragma("warning(pop)")
|
||||
#else
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH
|
||||
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// Indicate that a non-static, non-const C++ member function reinitializes
|
||||
// the entire object to a known state, independent of the previous state of
|
||||
// the object.
|
||||
|
||||
Reference in new issue
Block a user