[PATCH] D69958: Improve VFS compatibility on Windows
Adrian McCarthy via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 11:25:05 PST 2019
amccarth marked 3 inline comments as done.
amccarth added a comment.
Friendly ping for any VFS experts to comment.
================
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)))
----------------
rnk wrote:
> 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.
I felt the assumption is implicit in "path component," but I've made the comment more explicit. Note that the slash/backslash checks are checking the entire string. I hope that reinforces the idea that these would be path roots.
================
Comment at: llvm/lib/Support/VirtualFileSystem.cpp:1666
// paths become globally default.
if (Start->equals("."))
++Start;
----------------
rnk wrote:
> Unrelated, but I wonder if this needs to be `while` instead of `if` to handle repeated `foo/./././bar`.
I'm fairly certain I'll be looking into this further as I try to resolve the remaining VFS tests that don't run on Windows. I'd love to eliminate another #ifdef, but I want to keep this patch focused.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69958/new/
https://reviews.llvm.org/D69958
More information about the cfe-commits
mailing list