[PATCH] D113269: [clang-move] Fix unit tests with forward slash as separator on windows

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 5 05:06:31 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: aaron.ballman, sammccall.
mstorsjo requested review of this revision.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113269

Files:
  clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp


Index: clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
===================================================================
--- clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
+++ clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
@@ -208,7 +208,9 @@
                    DeclarationReporter *const Reporter = nullptr) {
   clang::RewriterTestContext Context;
 
-  Context.InMemoryFileSystem->setCurrentWorkingDirectory(WorkingDir);
+  llvm::SmallString<16> Dir(WorkingDir);
+  llvm::sys::path::native(Dir);
+  Context.InMemoryFileSystem->setCurrentWorkingDirectory(Dir);
 
   std::map<llvm::StringRef, clang::FileID> FileToFileID;
 
@@ -224,13 +226,13 @@
   CreateFiles(TestCCName, CC);
 
   std::map<std::string, tooling::Replacements> FileToReplacements;
-  ClangMoveContext MoveContext = {Spec, FileToReplacements, WorkingDir, "LLVM",
+  ClangMoveContext MoveContext = {Spec, FileToReplacements, Dir.c_str(), "LLVM",
                                   Reporter != nullptr};
 
   auto Factory = std::make_unique<clang::move::ClangMoveActionFactory>(
       &MoveContext, Reporter);
 
- // std::string IncludeArg = Twine("-I" + WorkingDir;
+ // std::string IncludeArg = Twine("-I" + Dir;
   tooling::runToolOnCodeWithArgs(
       Factory->create(), CC, Context.InMemoryFileSystem,
       {"-std=c++11", "-fparse-all-comments", "-I."}, TestCCName, "clang-move",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113269.385035.patch
Type: text/x-patch
Size: 1388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211105/57cbca99/attachment.bin>


More information about the cfe-commits mailing list