diff options
author | Juergen Ributzka <juergen@apple.com> | 2017-03-10 22:49:04 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2017-03-10 22:49:04 +0000 |
commit | 46541f1b0bc2126d2bb5b8c673ddec212c18c64e (patch) | |
tree | e91b3bece50c9c30f024ea7fa20db002f4242238 /clang/lib/Basic/VirtualFileSystem.cpp | |
parent | 83c37c4dac6cc0d8af01902e81cf6f6f4995c8f6 (diff) | |
download | llvm-46541f1b0bc2126d2bb5b8c673ddec212c18c64e.zip llvm-46541f1b0bc2126d2bb5b8c673ddec212c18c64e.tar.gz llvm-46541f1b0bc2126d2bb5b8c673ddec212c18c64e.tar.bz2 |
Reapply [VFS] Ignore broken symlinks in the directory iterator.
Modified the tests to accept any iteration order.
The VFS directory iterator and recursive directory iterator behave differently
from the LLVM counterparts. Once the VFS iterators hit a broken symlink they
immediately abort. The LLVM counterparts allow to recover from this issue by
clearing the error code and skipping to the next entry.
This change adds the same functionality to the VFS iterators. There should be
no change in current behavior in the current CLANG source base, because all
clients have loop exit conditions that also check the error code.
This fixes rdar://problem/30934619.
Differential Revision: https://reviews.llvm.org/D30768
llvm-svn: 297528
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r-- | clang/lib/Basic/VirtualFileSystem.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp index 43cd9f1..f5db717 100644 --- a/clang/lib/Basic/VirtualFileSystem.cpp +++ b/clang/lib/Basic/VirtualFileSystem.cpp @@ -244,8 +244,7 @@ public: if (!EC && Iter != llvm::sys::fs::directory_iterator()) { llvm::sys::fs::file_status S; EC = Iter->status(S); - if (!EC) - CurrentEntry = Status::copyWithNewName(S, Iter->path()); + CurrentEntry = Status::copyWithNewName(S, Iter->path()); } } @@ -1856,7 +1855,7 @@ vfs::recursive_directory_iterator::recursive_directory_iterator(FileSystem &FS_, std::error_code &EC) : FS(&FS_) { directory_iterator I = FS->dir_begin(Path, EC); - if (!EC && I != directory_iterator()) { + if (I != directory_iterator()) { State = std::make_shared<IterState>(); State->push(I); } @@ -1869,8 +1868,6 @@ recursive_directory_iterator::increment(std::error_code &EC) { vfs::directory_iterator End; if (State->top()->isDirectory()) { vfs::directory_iterator I = FS->dir_begin(State->top()->getName(), EC); - if (EC) - return *this; if (I != End) { State->push(I); return *this; |