[PATCH] D69958: Improve VFS compatibility on Windows

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 13:27:51 PST 2019


rnk added a comment.

This looks good to me. I had one suggestion, and I would also like to hear from another reviewer who has more ownership over VFS.



================
Comment at: llvm/include/llvm/Support/VirtualFileSystem.h:657
+  // slashes to match backslashes (and vice versa).
+  bool pathComponentMatches(llvm::StringRef lhs, llvm::StringRef rhs) const {
+    if ((CaseSensitive ? lhs.equals(rhs) : lhs.equals_lower(rhs)))
----------------
IIUC, this method receives path components, which must not contain path separators, or the root path component, `\` or `/`. Is there some way to express that invariant? Maybe just comment like "A path component must not contain path separators, unless it is the root component, which is represented as a single path separator," or an assert with the same effect.


================
Comment at: llvm/lib/Support/VirtualFileSystem.cpp:1666
   // paths become globally default.
   if (Start->equals("."))
     ++Start;
----------------
Unrelated, but I wonder if this needs to be `while` instead of `if` to handle repeated `foo/./././bar`.


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

https://reviews.llvm.org/D69958





More information about the llvm-commits mailing list