[clang] f1c08ee - [clang] NFCI: Use `FileEntryRef::getName()` in clangIndexSerialization

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 11:34:51 PST 2023


Author: Jan Svoboda
Date: 2023-12-06T11:34:46-08:00
New Revision: f1c08eebb3bb5eb6e984bcca511381a9748c6705

URL: https://github.com/llvm/llvm-project/commit/f1c08eebb3bb5eb6e984bcca511381a9748c6705
DIFF: https://github.com/llvm/llvm-project/commit/f1c08eebb3bb5eb6e984bcca511381a9748c6705.diff

LOG: [clang] NFCI: Use `FileEntryRef::getName()` in clangIndexSerialization

The clangIndexSerialization target seems to be unused, so it didn't build when I ran `check-all` before landing d1f86c3d. This should resolve the deprecation warning that caused some build bots to fail.

Added: 
    

Modified: 
    clang/include/clang/IndexSerialization/SerializablePathCollection.h
    clang/lib/IndexSerialization/SerializablePathCollection.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/IndexSerialization/SerializablePathCollection.h b/clang/include/clang/IndexSerialization/SerializablePathCollection.h
index 06948db6fc95f..6337a81196688 100644
--- a/clang/include/clang/IndexSerialization/SerializablePathCollection.h
+++ b/clang/include/clang/IndexSerialization/SerializablePathCollection.h
@@ -110,7 +110,7 @@ class SerializablePathCollection {
 
   /// Stores path to \p FE if it hasn't been stored yet.
   /// \returns index to array exposed by getPathsBuffer().
-  size_t tryStoreFilePath(const clang::FileEntry &FE);
+  size_t tryStoreFilePath(FileEntryRef FE);
 
 private:
   /// Stores \p Path if it is non-empty.

diff  --git a/clang/lib/IndexSerialization/SerializablePathCollection.cpp b/clang/lib/IndexSerialization/SerializablePathCollection.cpp
index 34663738088e8..bd5f861bf482e 100644
--- a/clang/lib/IndexSerialization/SerializablePathCollection.cpp
+++ b/clang/lib/IndexSerialization/SerializablePathCollection.cpp
@@ -45,8 +45,8 @@ SerializablePathCollection::SerializablePathCollection(
       SysRootPath(Paths.addDirPath(SysRoot)),
       OutputFilePath(Paths.addDirPath(OutputFile)) {}
 
-size_t SerializablePathCollection::tryStoreFilePath(const FileEntry &FE) {
-  auto FileIt = UniqueFiles.find(&FE);
+size_t SerializablePathCollection::tryStoreFilePath(FileEntryRef FE) {
+  auto FileIt = UniqueFiles.find(FE);
   if (FileIt != UniqueFiles.end())
     return FileIt->second;
 
@@ -54,7 +54,7 @@ size_t SerializablePathCollection::tryStoreFilePath(const FileEntry &FE) {
   const auto FileIdx =
       Paths.addFilePath(Dir.Root, Dir.Path, sys::path::filename(FE.getName()));
 
-  UniqueFiles.try_emplace(&FE, FileIdx);
+  UniqueFiles.try_emplace(FE, FileIdx);
   return FileIdx;
 }
 


        


More information about the cfe-commits mailing list