diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-08-13 16:26:44 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-08-13 16:26:44 +0000 |
commit | f59b1a92119b4fa04c1f981bde9a97546c46f797 (patch) | |
tree | 95ab4c15bd1c5eaf7796254f402bf3f7da330853 /clang/lib/Tooling | |
parent | bd9d059e6c2ee9ef287b3230e8cced45815f8316 (diff) | |
download | bcm5719-llvm-f59b1a92119b4fa04c1f981bde9a97546c46f797.tar.gz bcm5719-llvm-f59b1a92119b4fa04c1f981bde9a97546c46f797.zip |
Fixing a conflict detection bug in tooling::deduplicate
If a Replacment is contained within the conflict range being built, the
conflict range would be erroneously shortened. Now fixed. Tests updated to
catch this case.
llvm-svn: 188287
Diffstat (limited to 'clang/lib/Tooling')
-rw-r--r-- | clang/lib/Tooling/Refactoring.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Tooling/Refactoring.cpp b/clang/lib/Tooling/Refactoring.cpp index 8599f975120..52daaebfd21 100644 --- a/clang/lib/Tooling/Refactoring.cpp +++ b/clang/lib/Tooling/Refactoring.cpp @@ -206,8 +206,9 @@ void deduplicate(std::vector<Replacement> &Replaces, if (ConflictRange.overlapsWith(Current)) { // Extend conflicted range ConflictRange = Range(ConflictRange.getOffset(), - Current.getOffset() + Current.getLength() - - ConflictRange.getOffset()); + std::max(ConflictRange.getLength(), + Current.getOffset() + Current.getLength() - + ConflictRange.getOffset())); ++ConflictLength; } else { if (ConflictLength > 1) |