[clang/CodeGenActionTest] Use the platform's path separator for the `DebugInfoCWDCode...
authorArgyrios Kyrtzidis <kyrtzidis@apple.com>
Fri, 20 Jan 2023 18:14:11 +0000 (10:14 -0800)
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>
Fri, 20 Jan 2023 21:20:21 +0000 (13:20 -0800)
Fixes a failure in some Windows configuration.

Differential Revision: https://reviews.llvm.org/D142238

clang/unittests/Frontend/CodeGenActionTest.cpp

index d50648c..a652091 100644 (file)
@@ -82,9 +82,10 @@ TEST(CodeGenTest, DebugInfoCWDCodeGen) {
   // Check that debug info is accessing the current working directory from the
   // VFS instead of calling \p llvm::sys::fs::current_path() directly.
 
-  auto VFS = std::make_unique<llvm::vfs::InMemoryFileSystem>();
-  VFS->setCurrentWorkingDirectory("/in-memory-fs-cwd");
   auto Sept = llvm::sys::path::get_separator();
+  auto VFS = std::make_unique<llvm::vfs::InMemoryFileSystem>();
+  VFS->setCurrentWorkingDirectory(
+      std::string(llvm::formatv("{0}in-memory-fs-cwd", Sept)));
   std::string TestPath =
       std::string(llvm::formatv("{0}in-memory-fs-cwd{0}test.cpp", Sept));
   VFS->addFile(TestPath, 0, llvm::MemoryBuffer::getMemBuffer("int x;\n"));