[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 13:13:00 PST 2022
dexonsmith added a subscriber: benlangmuir.
dexonsmith added a comment.
In D116659#3237061 <https://reviews.llvm.org/D116659#3237061>, @jansvoboda11 wrote:
> I agree that introducing new iterator and implementing `iterator_range<...> FileSystem::dir_range()` is better solution than a macro.
>
> I'm not sure the `dir_range` function needs to take an `std::error_code` out-param though. The error code is only used to stop the iteration, clients don't use it for any other purpose. I think the new iterator could handle error codes completely internally (by advancing to the end), providing better ergonomics. WDYT?
>
> I might create a follow-up patches for //recursive// VFS-based iteration and also enable range-based for loops in code using `llvm::sys::fs` instead of the VFS.
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.
@benlangmuir, any thoughts on this?
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