[PATCH] D110711: [VFS] InMemoryFilesystem's UniqueIDs are a function of path and content.

Kadir Cetinkaya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 29 07:02:21 PDT 2021


kadircet added a comment.

thanks, i think it LG, with a couple questions :)



================
Comment at: llvm/include/llvm/Support/VirtualFileSystem.h:433
+  // as often needed in multithreaded programs.
+  sys::fs::UniqueID getUniqueID(hash_code) const;
+  sys::fs::UniqueID getFileID(sys::fs::UniqueID Parent, llvm::StringRef Name,
----------------
can't we just have these as implementation details? what's the point of them being members?


================
Comment at: llvm/lib/Support/VirtualFileSystem.cpp:707
     : Root(new detail::InMemoryDirectory(
-          Status("", getNextVirtualUniqueID(), llvm::sys::TimePoint<>(), 0, 0,
-                 0, llvm::sys::fs::file_type::directory_file,
+          Status("", getDirectoryID(llvm::sys::fs::UniqueID(), "(root)"),
+                 llvm::sys::TimePoint<>(), 0, 0, 0,
----------------
nit: maybe use an empty filename instead? (as we feed into the stat)


================
Comment at: llvm/lib/Support/VirtualFileSystem.cpp:731
+                                   llvm::StringRef Name) const {
+  return getUniqueID(llvm::hash_combine(Parent.getFile(), Name, 1));
+}
----------------
why the need for the extra `1` in the end?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110711/new/

https://reviews.llvm.org/D110711



More information about the llvm-commits mailing list