[Support] sys::fs::directory_entry includes the file_type.
authorKristina Brooks <kristina@nym.hush.com>
Wed, 12 Sep 2018 22:08:10 +0000 (22:08 +0000)
committerKristina Brooks <kristina@nym.hush.com>
Wed, 12 Sep 2018 22:08:10 +0000 (22:08 +0000)
commit3a55d1ef2774a0a814bd9e12cd8f4b34afd2e6df
tree7dd9a2b89e24bc5a3f34ba4384561c6c285f773a
parent2963c49087ebcae7c2f76ef738b8d5a73b262484
[Support] sys::fs::directory_entry includes the file_type.

This is available on most platforms (Linux/Mac/Win/BSD) with no extra syscalls.
On other platforms (e.g. Solaris) we stat() if this information is requested.

This will allow switching clang's VFS to efficiently expose (path, type) when
traversing a directory. Currently it exposes an entire Status, but does so by
calling fs::status() on all platforms.
Almost all callers only need the path, and all callers only need (path, type).

Patch by sammccall (Sam McCall)

Differential Revision: https://reviews.llvm.org/D51918

llvm-svn: 342089
llvm/include/llvm/Support/FileSystem.h
llvm/lib/Support/Path.cpp
llvm/lib/Support/Unix/Path.inc
llvm/lib/Support/Windows/Path.inc