diff --git a/clang/test/Index/index-module-with-vfs.m b/clang/test/Index/index-module-with-vfs.m --- a/clang/test/Index/index-module-with-vfs.m +++ b/clang/test/Index/index-module-with-vfs.m @@ -1,6 +1,3 @@ -// FIXME: PR43272 -// XFAIL: system-windows - @import ModuleNeedsVFS; void foo() { @@ -13,7 +10,7 @@ // RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -F %t -I %t \ // RUN: -ivfsoverlay %t.yaml -Xclang -fdisable-module-hash | FileCheck %s -// CHECK: [importedASTFile]: {{.*}}ModuleNeedsVFS.pcm | loc: 4:1 | name: "ModuleNeedsVFS" | isImplicit: 0 +// CHECK: [importedASTFile]: {{.*}}ModuleNeedsVFS.pcm | loc: 1:1 | name: "ModuleNeedsVFS" | isImplicit: 0 // CHECK: [indexEntityReference]: kind: function | name: module_needs_vfs // CHECK: [indexEntityReference]: kind: function | name: base_module_needs_vfs diff --git a/clang/test/Modules/double-quotes.m b/clang/test/Modules/double-quotes.m --- a/clang/test/Modules/double-quotes.m +++ b/clang/test/Modules/double-quotes.m @@ -1,6 +1,3 @@ -// FIXME: PR43272 -// XFAIL: system-windows - // RUN: rm -rf %t // RUN: mkdir %t diff --git a/clang/test/Modules/framework-public-includes-private.m b/clang/test/Modules/framework-public-includes-private.m --- a/clang/test/Modules/framework-public-includes-private.m +++ b/clang/test/Modules/framework-public-includes-private.m @@ -1,6 +1,3 @@ -// FIXME: PR43272 -// XFAIL: system-windows - // RUN: rm -rf %t // RUN: mkdir %t diff --git a/clang/test/VFS/external-names.c b/clang/test/VFS/external-names.c --- a/clang/test/VFS/external-names.c +++ b/clang/test/VFS/external-names.c @@ -1,9 +1,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" -e "s@EXTERNAL_NAMES@true@" %S/Inputs/use-external-names.yaml > %t.external.yaml // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" -e "s@EXTERNAL_NAMES@false@" %S/Inputs/use-external-names.yaml > %t.yaml -// FIXME: PR43272 -// XFAIL: system-windows - #include "external-names.h" #ifdef REINCLUDE #include "external-names.h" diff --git a/clang/test/VFS/framework-import.m b/clang/test/VFS/framework-import.m --- a/clang/test/VFS/framework-import.m +++ b/clang/test/VFS/framework-import.m @@ -1,9 +1,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -F %t -ivfsoverlay %t.yaml -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #import void foo() { diff --git a/clang/test/VFS/implicit-include.c b/clang/test/VFS/implicit-include.c --- a/clang/test/VFS/implicit-include.c +++ b/clang/test/VFS/implicit-include.c @@ -1,9 +1,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -include "not_real.h" -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - void foo() { bar(); } diff --git a/clang/test/VFS/include-mixed-real-and-virtual.c b/clang/test/VFS/include-mixed-real-and-virtual.c --- a/clang/test/VFS/include-mixed-real-and-virtual.c +++ b/clang/test/VFS/include-mixed-real-and-virtual.c @@ -4,9 +4,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #include "not_real.h" #include "real.h" diff --git a/clang/test/VFS/include-real-from-virtual.c b/clang/test/VFS/include-real-from-virtual.c --- a/clang/test/VFS/include-real-from-virtual.c +++ b/clang/test/VFS/include-real-from-virtual.c @@ -4,9 +4,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #include "include_real.h" void foo() { diff --git a/clang/test/VFS/include-virtual-from-real.c b/clang/test/VFS/include-virtual-from-real.c --- a/clang/test/VFS/include-virtual-from-real.c +++ b/clang/test/VFS/include-virtual-from-real.c @@ -4,9 +4,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #include "include_not_real.h" void foo() { diff --git a/clang/test/VFS/include.c b/clang/test/VFS/include.c --- a/clang/test/VFS/include.c +++ b/clang/test/VFS/include.c @@ -1,9 +1,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -I %t -ivfsoverlay %t.yaml -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #include "not_real.h" void foo() { diff --git a/clang/test/VFS/incomplete-umbrella.m b/clang/test/VFS/incomplete-umbrella.m --- a/clang/test/VFS/incomplete-umbrella.m +++ b/clang/test/VFS/incomplete-umbrella.m @@ -5,9 +5,6 @@ // RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -ivfsoverlay %t.yaml -F %t -fsyntax-only %s 2>&1 | FileCheck %s -// FIXME: PR43272 -// XFAIL: system-windows - @import Incomplete; // CHECK: umbrella header for module 'Incomplete' {{.*}}IncompleteVFS.h // CHECK: umbrella header for module 'Incomplete' {{.*}}IncompleteReal.h diff --git a/clang/test/VFS/module-import.m b/clang/test/VFS/module-import.m --- a/clang/test/VFS/module-import.m +++ b/clang/test/VFS/module-import.m @@ -2,9 +2,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - @import not_real; void foo() { diff --git a/clang/test/VFS/real-path-found-first.m b/clang/test/VFS/real-path-found-first.m --- a/clang/test/VFS/real-path-found-first.m +++ b/clang/test/VFS/real-path-found-first.m @@ -4,9 +4,6 @@ // intentionally rebuild modules, since the precompiled module file refers to // the dependency files by real path. -// FIXME: PR43272 -// XFAIL: system-windows - // RUN: rm -rf %t %t-cache %t.pch // RUN: mkdir -p %t/SomeFramework.framework/Modules // RUN: cat %S/Inputs/some_frame_module.map > %t/SomeFramework.framework/Modules/module.modulemap diff --git a/clang/test/VFS/relative-path.c b/clang/test/VFS/relative-path.c --- a/clang/test/VFS/relative-path.c +++ b/clang/test/VFS/relative-path.c @@ -3,9 +3,6 @@ // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -I . -ivfsoverlay %t.yaml -fsyntax-only %s -// FIXME: PR43272 -// XFAIL: system-windows - #include "not_real.h" void foo() { diff --git a/clang/test/VFS/umbrella-framework-import-skipnonexist.m b/clang/test/VFS/umbrella-framework-import-skipnonexist.m --- a/clang/test/VFS/umbrella-framework-import-skipnonexist.m +++ b/clang/test/VFS/umbrella-framework-import-skipnonexist.m @@ -1,8 +1,5 @@ // REQUIRES: crash-recovery -// FIXME: PR43272 -// XFAIL: system-windows - // RUN: rm -rf %t // RUN: mkdir -p %t/vdir %t/outdir %t/cache // RUN: cp -R %S/Inputs/Bar.framework %t/outdir/ diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h --- a/llvm/include/llvm/Support/VirtualFileSystem.h +++ b/llvm/include/llvm/Support/VirtualFileSystem.h @@ -532,7 +532,7 @@ /// \endverbatim /// /// All configuration options are optional. -/// 'case-sensitive': +/// 'case-sensitive': /// 'use-external-names': /// 'overlay-relative': /// 'fallthrough': @@ -651,6 +651,17 @@ return ExternalFSValidWD && IsFallthrough; } + // In a RedirectingFileSystem, keys can be specified in Posix or Windows + // style (or even a mixture of both), so this comparison helper allows + // slashes (representing a root) to match backslashes (and vice versa). Note + // that, other than the root, patch components should not contain slashes or + // backslashes. + bool pathComponentMatches(llvm::StringRef lhs, llvm::StringRef rhs) const { + if ((CaseSensitive ? lhs.equals(rhs) : lhs.equals_lower(rhs))) + return true; + return (lhs == "/" && rhs == "\\") || (lhs == "\\" && rhs == "/"); + } + /// The root(s) of the virtual file system. std::vector> Roots; @@ -674,7 +685,12 @@ /// Whether to perform case-sensitive comparisons. /// /// Currently, case-insensitive matching only works correctly with ASCII. - bool CaseSensitive = true; + bool CaseSensitive = +#ifdef _WIN32 + false; +#else + true; +#endif /// IsRelativeOverlay marks whether a ExternalContentsPrefixDir path must /// be prefixed in every 'external-contents' when reading from YAML files. diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -1671,9 +1671,7 @@ // 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 @@ if (Result || Result.getError() != llvm::errc::no_such_file_or_directory) return Result; } + return make_error_code(llvm::errc::no_such_file_or_directory); }