diff options
author | Eric Liu <ioeric@google.com> | 2016-11-07 06:08:23 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2016-11-07 06:08:23 +0000 |
commit | cf2913c6f12fbade57640c3410eb95d05baa27e5 (patch) | |
tree | c159262c42184301d0e9ebbe3669ffa8c878d2d3 /clang/lib/Tooling/Refactoring.cpp | |
parent | c988b334b6a97a87b887df7aa22500961faf7701 (diff) | |
download | llvm-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.cpp | 6 |
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; |