aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/Refactoring.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-11-07 06:08:23 +0000
committerEric Liu <ioeric@google.com>2016-11-07 06:08:23 +0000
commitcf2913c6f12fbade57640c3410eb95d05baa27e5 (patch)
treec159262c42184301d0e9ebbe3669ffa8c878d2d3 /clang/lib/Tooling/Refactoring.cpp
parentc988b334b6a97a87b887df7aa22500961faf7701 (diff)
downloadllvm-cf2913c6f12fbade57640c3410eb95d05baa27e5.zip
llvm-cf2913c6f12fbade57640c3410eb95d05baa27e5.tar.gz
llvm-cf2913c6f12fbade57640c3410eb95d05baa27e5.tar.bz2
Deduplicate replacements by FileEntry instead of file names.
Summary: The current version does not deduplicate equivalent file paths correctly. For example, a relative path and an absolute path are considered inequivalent. Comparing FileEnry addresses these issues. Reviewers: djasper Subscribers: alexshap, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D26288 llvm-svn: 286096
Diffstat (limited to 'clang/lib/Tooling/Refactoring.cpp')
-rw-r--r--clang/lib/Tooling/Refactoring.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Tooling/Refactoring.cpp b/clang/lib/Tooling/Refactoring.cpp
index 241557d..308c1ac 100644
--- a/clang/lib/Tooling/Refactoring.cpp
+++ b/clang/lib/Tooling/Refactoring.cpp
@@ -57,7 +57,8 @@ int RefactoringTool::runAndSave(FrontendActionFactory *ActionFactory) {
bool RefactoringTool::applyAllReplacements(Rewriter &Rewrite) {
bool Result = true;
- for (const auto &Entry : groupReplacementsByFile(FileToReplaces))
+ for (const auto &Entry : groupReplacementsByFile(
+ Rewrite.getSourceMgr().getFileManager(), FileToReplaces))
Result = tooling::applyAllReplacements(Entry.second, Rewrite) && Result;
return Result;
}
@@ -73,7 +74,8 @@ bool formatAndApplyAllReplacements(
FileManager &Files = SM.getFileManager();
bool Result = true;
- for (const auto &FileAndReplaces : groupReplacementsByFile(FileToReplaces)) {
+ for (const auto &FileAndReplaces : groupReplacementsByFile(
+ Rewrite.getSourceMgr().getFileManager(), FileToReplaces)) {
const std::string &FilePath = FileAndReplaces.first;
auto &CurReplaces = FileAndReplaces.second;