[clang-tools-extra] 98f0bf7 - [clang-move] Fix unit tests with forward slash as separator on windows

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 8 12:22:09 PST 2021


Author: Martin Storsjö
Date: 2021-11-08T22:21:31+02:00
New Revision: 98f0bf74ca6d7aa9b3c2b240693824f085aa6675

URL: https://github.com/llvm/llvm-project/commit/98f0bf74ca6d7aa9b3c2b240693824f085aa6675
DIFF: https://github.com/llvm/llvm-project/commit/98f0bf74ca6d7aa9b3c2b240693824f085aa6675.diff

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

Also remove a comment that seems to be left behind.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp b/clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
index b9553e111a578..082779358fbfb 100644
--- a/clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
+++ b/clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp
@@ -208,7 +208,9 @@ runClangMoveOnCode(const move::MoveDefinitionSpec &Spec,
                    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 @@ runClangMoveOnCode(const move::MoveDefinitionSpec &Spec,
   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",


        


More information about the cfe-commits mailing list