[PATCH] D116659: [llvm][clang][vfs] NFC: Simplify directory iteration

Jan Svoboda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 02:55:36 PST 2022


jansvoboda11 added a comment.

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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116659/new/

https://reviews.llvm.org/D116659



More information about the llvm-commits mailing list