The "regular" file system has a useful feature that makes it possible to stop recursing when using the recursive directory iterators. This functionality was missing for the VFS recursive iterator and this patch adds that.
I am gravitating towards having a separate unit test(s) for no_push functionality. Maybe I'm wrong but I expect it to be smaller and easier to understand, though there'll be some boilerplate.
Implementation looks reasonable but I'm not sure about a few edge cases:
- call no_push before starting iteration;
- call no_push after we finished iteration (here I mean when we are pointing to the last directory, before the iterator becomes end iterator);
- call no_push for a directory that has no children and we wouldn't descend into anyway.
I think in these cases VFS iterator should behave as llvm::sys::fs::recursive_directory_iterator unless it is doing something strange. Not sure all these cases deserve a test, depends on the fact if they execute different paths in implementation.
|484–486 ↗||(On Diff #170288)|
Is Counts supposed to be // f?
Thanks for the review, Volodymyr! I've extended the test which I believe covers all the cases you mentioned. The implementation is almost identical to how no_push is handled in the non-VFS filesystem implementation, so the behavior should indeed be identical.