diff options
author | Adrian McCarthy <amccarth@google.com> | 2019-11-07 10:50:33 -0800 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2019-11-14 08:48:47 -0800 |
commit | 1275ab1620b665eb06231ce3c4e5068c97d9b618 (patch) | |
tree | 64bca2aef09e015a26b9dbbb58046982b415b721 /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | bbcbb10e2d0848b611c51b1ff56c758645c55f3b (diff) | |
download | bcm5719-llvm-1275ab1620b665eb06231ce3c4e5068c97d9b618.tar.gz bcm5719-llvm-1275ab1620b665eb06231ce3c4e5068c97d9b618.zip |
Improve VFS compatibility on Windows
Keys in a virtual file system can be in Posix or Windows form or even
a combination of the two. Many VFS tests (and a few Clang tests) were
XFAILed on Windows because of false negatives when comparing paths.
First, we default CaseSenstive to false on Windows. This allows
drive letters like "D:" to match "d:". Windows filesystems are, by
default, case insensitive, so this makes sense even beyond the drive
letter.
Second, we allow slashes to match backslashes when they're used as the
root component of a path.
Both of these changes are limited to RedirectingFileSystems, so there's
little chance of affecting other path handling.
These changes allow eleven of the VFS tests to pass on Windows as well
as three other Clang tests, so they have re-enabled.
This solves the majority of PR43272. Additional VFS test failures will
be fixed in separate patches.
Differential Revision: https://reviews.llvm.org/D69958
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index 40b748eab18..2d5c04baa57 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -1671,9 +1671,7 @@ RedirectingFileSystem::lookupPath(sys::path::const_iterator Start, // Forward the search to the next component in case this is an empty one. if (!FromName.empty()) { - if (CaseSensitive ? !Start->equals(FromName) - : !Start->equals_lower(FromName)) - // failure to match + if (!pathComponentMatches(*Start, FromName)) return make_error_code(llvm::errc::no_such_file_or_directory); ++Start; @@ -1695,6 +1693,7 @@ RedirectingFileSystem::lookupPath(sys::path::const_iterator Start, if (Result || Result.getError() != llvm::errc::no_such_file_or_directory) return Result; } + return make_error_code(llvm::errc::no_such_file_or_directory); } |