[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 11 03:37:01 PDT 2018


sammccall created this revision.
sammccall added a reviewer: bkramer.
Herald added subscribers: cfe-commits, fedor.sergeev.

Most callers I can find are using only `getName()`. Type is used by the
recursive iterator.

Now we don't have to call stat() on every listed file (on most platforms).
Exceptions are e.g. Solaris where readdir() doesn't include type information.
On those platforms we'll still stat() - see https://reviews.llvm.org/D51918.

The result is significantly faster (stat() can be slow).
My motivation: this may allow us to improve clang IO on large TUs with long
include search paths. Caching readdir() results may allow us to skip many stat()
and open() operations on nonexistent files.


Repository:
  rC Clang

https://reviews.llvm.org/D51921

Files:
  include/clang/Basic/VirtualFileSystem.h
  lib/Basic/VirtualFileSystem.cpp
  unittests/Basic/VirtualFileSystemTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51921.164838.patch
Type: text/x-patch
Size: 11312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180911/dad054fd/attachment-0001.bin>


More information about the cfe-commits mailing list