summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-10-10 22:19:46 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-10-10 22:19:46 +0000
commit0dfdb44797fa2ce4273e38f13403b62a5ce0a9b0 (patch)
tree7b4289f7eca8c5267e89a0a1fad53657e56dfe69 /llvm/unittests/Support/Path.cpp
parentae5e9ed422be46d63384b7a9efdf925c4507994f (diff)
downloadbcm5719-llvm-0dfdb44797fa2ce4273e38f13403b62a5ce0a9b0.tar.gz
bcm5719-llvm-0dfdb44797fa2ce4273e38f13403b62a5ce0a9b0.zip
Support: Have directory_iterator::status() return FindFirstFileEx/FindNextFile results on Windows.
This allows clients to avoid an unnecessary fs::status() call on each directory entry. Because the information returned by FindFirstFileEx is a subset of the information returned by a regular status() call, I needed to extract a base class from file_status that contains only that information. On my machine, this reduces the time required to enumerate a ThinLTO cache directory containing 520k files from almost 4 minutes to less than 2 seconds. Differential Revision: https://reviews.llvm.org/D38716 llvm-svn: 315378
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r--llvm/unittests/Support/Path.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 4de2e648259..a798928e4e5 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -869,8 +869,8 @@ TEST_F(FileSystemTest, BrokenSymlinkDirectoryIteration) {
i != e; i.increment(ec)) {
ASSERT_NO_ERROR(ec);
- fs::file_status status;
- if (i->status(status) ==
+ ErrorOr<fs::basic_file_status> status = i->status();
+ if (status.getError() ==
std::make_error_code(std::errc::no_such_file_or_directory)) {
i.no_push();
continue;
OpenPOWER on IntegriCloud