[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
Mon Nov 8 12:22:17 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG98f0bf74ca6d: [clang-move] Fix unit tests with forward slash as separator on windows (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D113269?vs=385035&id=385592#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113269/new/

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,12 @@
   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;
   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.385592.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211108/d87fc48c/attachment-0001.bin>


More information about the cfe-commits mailing list