[libcxx-commits] [libcxx] [libcxx] Cache file attributes during directory iteration. (PR #93316)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 3 07:46:34 PDT 2024


================
@@ -77,13 +77,18 @@ class __dir_stream {
   bool assign() {
     if (!wcscmp(__data_.cFileName, L".") || !wcscmp(__data_.cFileName, L".."))
       return false;
-    // FIXME: Cache more of this
-    // directory_entry::__cached_data cdata;
-    // cdata.__type_ = get_file_type(__data_);
-    // cdata.__size_ = get_file_size(__data_);
-    // cdata.__write_time_ = get_write_time(__data_);
     __entry_.__assign_iter_entry(
-        __root_ / __data_.cFileName, directory_entry::__create_iter_result(detail::get_file_type(__data_)));
+        __root_ / __data_.cFileName,
+#  if _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_FULLY_POPULATED_CACHED_ENTRY
----------------
ldionne wrote:

This doesn't have to be conditionalized -- we basically always want to populate the cache as much as possible from the dylib side, the only question is whether the headers can *assume* that the cache has been fully populated.

https://github.com/llvm/llvm-project/pull/93316


More information about the libcxx-commits mailing list