[PATCH] D117650: [llvm][vfs] Implement in-memory symlinks

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 05:50:26 PDT 2022


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG, thanks for the changes!
I wouldn't bother splitting out the commits for something this size.



================
Comment at: llvm/lib/Support/VirtualFileSystem.cpp:1140
+    return directory_iterator(std::make_shared<InMemoryDirIterator>(
+        [&](const Twine &P) {
+          return lookupNode(P, /*FollowFinalSymlink=*/true);
----------------
jansvoboda11 wrote:
> We're passing a lambda here since `lookupNode` is (and should remain) private to `InMemoryFileSystem` and `InMemoryDirIterator` is in anonymous namespace so it can't be befriended. An alternative to this solution would be to pull `InMemoryDirIterator` into the `detail` namespace and forward-declare it in the friend declaration inside `InMemoryFileSystem`. I don't have strong feelings either way.
Yeah :-( I find friending it slightly cleaner, but don't feel strongly, feel free to leave it.

An alternative very similar to friending: forward-declare it as a nested class of InMemoryFileSystem (which makes it implicitly a friend, but also `InMemoryFileSystem::DirIterator` seems a slightly more obvious name than `detail::InMemoryDirIterator`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117650



More information about the llvm-commits mailing list