[PATCH] D116659: [llvm][clang][vfs] NFC: Simplify directory iteration
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 13 14:07:49 PST 2022
dexonsmith added a comment.
In D116659#3241727 <https://reviews.llvm.org/D116659#3241727>, @benlangmuir wrote:
>> I don't know, I'm a bit skeptical we want to make it so easy to ignore errors so easily. I'd rather require clients to explicitly ignore the error.
>
> That's my gut feeling too. I suspect a bunch of this code should be explicitly ignoring `ENOENT`, but not ignoring e.g. `EACCESS`, `EMFILE `, etc. It seems like a bug that we're ignoring all errors right now.
>
> If we really want to ignore all the iteration errors, we should do that consistently in llvm::sys::fs not just the wrapper in the VFS layer.
If the main goal is to enable range-based-for, a simpler option than I suggested previously might be to have an iterator that dereferences to `ErrorOr<FileEntry>`. Could be an iterator adaptor that takes any `increment(EC)`-style iterator (either `llvm::sys::fs` or `llvm::vfs`). Maybe `dir_range` could return `ErrorOr<iterator_range<...>>` to expose the error-on-construction explicitly as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116659/new/
https://reviews.llvm.org/D116659
More information about the cfe-commits
mailing list