Index: clang/lib/Lex/HeaderSearch.cpp =================================================================== --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -773,16 +773,14 @@ // include of "baz.h" should resolve to "whatever/foo/baz.h". // This search is not done for <> headers. if (!Includers.empty() && !isAngled && !NoCurDirSearch) { - SmallString<1024> TmpDir; + SmallString<1024> TmpPath; bool First = true; for (const auto &IncluderAndDir : Includers) { const FileEntry *Includer = IncluderAndDir.first; // Concatenate the requested file onto the directory. - // FIXME: Portability. Filename concatenation should be in sys::Path. - TmpDir = IncluderAndDir.second->getName(); - TmpDir.push_back('/'); - TmpDir.append(Filename.begin(), Filename.end()); + TmpPath = IncluderAndDir.second->getName(); + llvm::sys::path::append(TmpPath, Filename); // FIXME: We don't cache the result of getFileInfo across the call to // getFileAndSuggestModule, because it's a reference to an element of @@ -795,7 +793,7 @@ Includer ? getFileInfo(Includer).DirInfo != SrcMgr::C_User : BuildSystemModule; if (Optional FE = getFileAndSuggestModule( - TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, + TmpPath, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, RequestingModule, SuggestedModule)) { if (!Includer) { assert(First && "only first includer can have no file"); Index: clang/test/VFS/external-names.c =================================================================== --- clang/test/VFS/external-names.c +++ clang/test/VFS/external-names.c @@ -13,7 +13,7 @@ // Preprocessor (__FILE__ macro and # directives): // RUN: %clang_cc1 -I %t -ivfsoverlay %t.external.yaml -E %s | FileCheck -check-prefix=CHECK-PP-EXTERNAL %s -// CHECK-PP-EXTERNAL: # {{[0-9]*}} "[[NAME:.*Inputs.external-names.h]]" +// CHECK-PP-EXTERNAL: # {{[0-9]*}} "[[NAME:.*Inputs(\\\\|/)external-names.h]]" // CHECK-PP-EXTERNAL-NEXT: void foo(char **c) { // CHECK-PP-EXTERNAL-NEXT: *c = "[[NAME]]"; @@ -34,7 +34,7 @@ // RUN: %clang_cc1 -I %t -ivfsoverlay %t.external.yaml -triple %itanium_abi_triple -debug-info-kind=limited -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-DEBUG-EXTERNAL %s // CHECK-DEBUG-EXTERNAL: !DISubprogram({{.*}}file: ![[Num:[0-9]+]] -// CHECK-DEBUG-EXTERNAL: ![[Num]] = !DIFile(filename: "{{[^"]*}}Inputs{{.}}external-names.h" +// CHECK-DEBUG-EXTERNAL: ![[Num]] = !DIFile(filename: "{{[^"]*}}Inputs(\5C|/)external-names.h" // RUN: %clang_cc1 -I %t -ivfsoverlay %t.yaml -triple %itanium_abi_triple -debug-info-kind=limited -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-DEBUG %s // CHECK-DEBUG-NOT: Inputs Index: clang/test/VFS/framework-import.m =================================================================== --- clang/test/VFS/framework-import.m +++ 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() { Index: clang/test/VFS/implicit-include.c =================================================================== --- clang/test/VFS/implicit-include.c +++ 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(); } Index: clang/test/VFS/include-mixed-real-and-virtual.c =================================================================== --- clang/test/VFS/include-mixed-real-and-virtual.c +++ 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" Index: clang/test/VFS/include-real-from-virtual.c =================================================================== --- clang/test/VFS/include-real-from-virtual.c +++ 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() { Index: clang/test/VFS/include-virtual-from-real.c =================================================================== --- clang/test/VFS/include-virtual-from-real.c +++ 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() { Index: clang/test/VFS/include.c =================================================================== --- clang/test/VFS/include.c +++ 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() { Index: clang/test/VFS/incomplete-umbrella.m =================================================================== --- clang/test/VFS/incomplete-umbrella.m +++ 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 Index: clang/test/VFS/module-import.m =================================================================== --- clang/test/VFS/module-import.m +++ 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() { Index: clang/test/VFS/real-path-found-first.m =================================================================== --- clang/test/VFS/real-path-found-first.m +++ 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 Index: clang/test/VFS/relative-path.c =================================================================== --- clang/test/VFS/relative-path.c +++ 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() { Index: clang/test/VFS/umbrella-framework-import-skipnonexist.m =================================================================== --- clang/test/VFS/umbrella-framework-import-skipnonexist.m +++ 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/ Index: llvm/lib/Support/VirtualFileSystem.cpp =================================================================== --- llvm/lib/Support/VirtualFileSystem.cpp +++ llvm/lib/Support/VirtualFileSystem.cpp @@ -1303,16 +1303,15 @@ return nullptr; NameValueNode = I.getValue(); + SmallString<256> Path(Value); if (FS->UseCanonicalizedPaths) { - SmallString<256> Path(Value); // Guarantee that old YAML files containing paths with ".." and "." // are properly canonicalized before read into the VFS. Path = sys::path::remove_leading_dotslash(Path); sys::path::remove_dots(Path, /*remove_dot_dot=*/true); - Name = Path.str(); - } else { - Name = Value; } + sys::path::native(Path); + Name = Path.str(); } else if (Key == "type") { if (!parseScalarString(I.getValue(), Value, Buffer)) return nullptr; @@ -1371,6 +1370,7 @@ FullPath = sys::path::remove_leading_dotslash(FullPath); sys::path::remove_dots(FullPath, /*remove_dot_dot=*/true); } + sys::path::native(FullPath); ExternalContentsPath = FullPath.str(); } else if (Key == "use-external-name") { bool Val; @@ -1831,11 +1831,12 @@ RedirectingFileSystem *VFS = RedirectingFileSystem::create( std::move(Buffer), DiagHandler, YAMLFilePath, DiagContext, std::move(ExternalFS)); - ErrorOr RootE = VFS->lookupPath("/"); + ErrorOr RootE = + VFS->lookupPath(sys::path::get_separator()); if (!RootE) return; SmallVector Components; - Components.push_back("/"); + Components.push_back(sys::path::get_separator()); getVFSEntries(*RootE, Components, CollectedEntries); }