[PATCH] D48951: [clang-move] ClangMoveTests: Remove dots in output paths
This revision was automatically updated to reflect the committed changes. Closed by commit rL336358: [clang-move] ClangMoveTests: Remove dots in output paths (authored by simark, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48951 Files: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp Index: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp === --- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp +++ clang-tools-extra/trunk/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 Results; for (const auto : 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: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp === --- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp +++ clang-tools-extra/trunk/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 Results; for (const auto : 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
[PATCH] D48951: [clang-move] ClangMoveTests: Remove dots in output paths
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Looks good. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48951: [clang-move] ClangMoveTests: Remove dots in output paths
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 Results; for (const auto : 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 Results; for (const auto : 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