[clang-tools-extra] [lld] [llvm] [Clangd][LIT][LLD] Fix Windows test failures due to path separator mismatches (PR #179410)

Takuto Ikuta via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 3 01:15:52 PST 2026


================
@@ -82,12 +82,14 @@ MockCompilationDatabase::getCompileCommand(PathRef File) const {
                                   FileName, std::move(CommandLine), "")};
 }
 
-const char *testRoot() {
+std::string testRoot() {
+  llvm::SmallString<32> Path;
 #ifdef _WIN32
-  return "C:\\clangd-test";
+  llvm::sys::path::native("C:/clangd-test", Path);
 #else
-  return "/clangd-test";
+  llvm::sys::path::native("/clangd-test", Path);
 #endif
+  return std::string(Path.str());
----------------
atetubou wrote:

`.str()` is redundant per https://github.com/llvm/llvm-project/blob/56d31697c2a2c38844bdc0f43e537c29a5115d87/llvm/include/llvm/ADT/SmallString.h#L268?

```suggestion
  return std::string(Path);
```

https://github.com/llvm/llvm-project/pull/179410


More information about the cfe-commits mailing list