diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-07-23 22:40:41 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-07-23 22:40:41 +0000 |
commit | f96de0296023ef936d62191803ecb48622e6b085 (patch) | |
tree | 172158b703b80d74a8a2686fb1b18ef32f2e96b0 /libcxx/include/experimental | |
parent | 82d975afa095669a52a2b9cf092d255b7c4b96e4 (diff) | |
download | bcm5719-llvm-f96de0296023ef936d62191803ecb48622e6b085.tar.gz bcm5719-llvm-f96de0296023ef936d62191803ecb48622e6b085.zip |
Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
The initial patch didn't correctly handle systems when the dirent struct
didn't provide the d_type member. Specifically it set the cache to the incorrect state,
and claimed it was partially populated.
The updated version of this change correctly handles setting up the
cache when the file type is not known (aka file_type::none).
llvm-svn: 337765
Diffstat (limited to 'libcxx/include/experimental')
-rw-r--r-- | libcxx/include/experimental/filesystem | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem index 2ed3eecffea..9699699c718 100644 --- a/libcxx/include/experimental/filesystem +++ b/libcxx/include/experimental/filesystem @@ -2200,8 +2200,16 @@ private: static __cached_data __create_iter_result(file_type __ft) { __cached_data __data; __data.__type_ = __ft; - __data.__cache_type_ = - __ft == file_type::symlink ? _IterSymlink : _IterNonSymlink; + __data.__cache_type_ = [&]() { + switch (__ft) { + case file_type::none: + return _Empty; + case file_type::symlink: + return _IterSymlink; + default: + return _IterNonSymlink; + } + }(); return __data; } |