[PATCH] D52648: [Support] Listing a directory containing dangling symlinks is not an error.
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 28 09:01:24 PDT 2018
vsk added a comment.
Thanks for the patch.
================
Comment at: include/llvm/Support/FileSystem.h:1259
else {
- ErrorOr<basic_file_status> status = State->Stack.top()->status();
- if (status && is_directory(*status)) {
+ file_type type = State->Stack.top()->type();
+ if (type == file_type::symlink_file && Follow) {
----------------
I'm struggling to understand how work is saved here. Do you mind explaining in some more detail? Specifically, I'm not sure why determining `file_type` is cheaper than getting a `basic_file_status`. Don't both stat()?
================
Comment at: tools/llvm-cov/CodeCoverage.cpp:218
- if (EC) {
- warning(EC.message(), F->path());
+ auto Status = F->status();
+ if (!Status) {
----------------
Do all clients of the directory iterator need to check status(), or is llvm-cov the weird one?
================
Comment at: unittests/Support/Path.cpp:887
+ using testing::UnorderedElementsAre;
+ using testing::UnorderedElementsAreArray;
----------------
Nice!
Repository:
rL LLVM
https://reviews.llvm.org/D52648
More information about the llvm-commits
mailing list