[PATCH] D97288: Added `Follow` parameter to llvm::vfs::FileSystem::status()

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 19:29:17 PST 2021


dexonsmith added a comment.

If we do add this, I'd suggest a separate function rather than modifying the current one. I also think implementing it should be optional. Something like:

  virtual ErrorOr<vfs::Status> status(const Twine &Path) = 0;
  virtual ErrorOr<vfs::Status> status(const Twine &Path, bool FollowSymlinks) {
    // By default ignore the request not to follow symlinks.
    (void)FollowSymlinks;
    return status(Path);
  }

or, maybe better / more clear with a distinct name:

  virtual ErrorOr<vfs::Status> statusNoFollow(const Twine &Path) {
    // By default ignore the request not to follow symlinks.
    return status(Path);
  }

Note that there's also a hole in FileSystem::dir_begin which also always follows symlinks; perhaps the parallel features could be implemented (or not) at the same time.

That said, I agree it'd be nice to have a use case for this before expanding the API.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97288



More information about the llvm-commits mailing list