simark created this revision. Herald added subscribers: cfe-commits, ioeric.
Following https://reviews.llvm.org/D48903 ([VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name), the paths output by clang-move in the FileToReplacements map may contain leading "./". For example, where we would get "foo.h", we'll now get "./foo.h". This breaks the tests, because we are doing exact string lookups in the FileToFileID and Results maps (they contain "foo.h", but we search for "./foo.h"). To mitigate this, try to normalize a little bit the paths output by clang-move to remove that leading "./". This patch should be safe to merge before https://reviews.llvm.org/D48903, remove_dots will just be a no-op. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48951 Files: unittests/clang-move/ClangMoveTests.cpp Index: unittests/clang-move/ClangMoveTests.cpp =================================================================== --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -239,8 +239,10 @@ // The Key is file name, value is the new code after moving the class. std::map<std::string, std::string> Results; for (const auto &It : FileToReplacements) { - StringRef FilePath = It.first; - Results[FilePath] = Context.getRewrittenText(FileToFileID[FilePath]); + // The path may come out as "./foo.h", normalize to "foo.h". + SmallString<32> FilePath (It.first); + llvm::sys::path::remove_dots(FilePath); + Results[FilePath.str().str()] = Context.getRewrittenText(FileToFileID[FilePath]); } return Results; }
Index: unittests/clang-move/ClangMoveTests.cpp =================================================================== --- unittests/clang-move/ClangMoveTests.cpp +++ unittests/clang-move/ClangMoveTests.cpp @@ -239,8 +239,10 @@ // The Key is file name, value is the new code after moving the class. std::map<std::string, std::string> Results; for (const auto &It : FileToReplacements) { - StringRef FilePath = It.first; - Results[FilePath] = Context.getRewrittenText(FileToFileID[FilePath]); + // The path may come out as "./foo.h", normalize to "foo.h". + SmallString<32> FilePath (It.first); + llvm::sys::path::remove_dots(FilePath); + Results[FilePath.str().str()] = Context.getRewrittenText(FileToFileID[FilePath]); } return Results; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits