]> granicus.if.org Git - clang/commit
When replacements have the same offset, make replacements with smaller length order...
authorEric Liu <ioeric@google.com>
Sat, 17 Sep 2016 12:26:42 +0000 (12:26 +0000)
committerEric Liu <ioeric@google.com>
Sat, 17 Sep 2016 12:26:42 +0000 (12:26 +0000)
commit18e5245c5a5ae0867d04257b4b56540ac38aad24
treebfd5baf3c0fd525951365d4d71fcd4c11a22ed82
parent72aeae9a2f042f160e700b97fde61be3e0adc133
When replacements have the same offset, make replacements with smaller length order first in the set.

Summary:
No behavioral change intended. The change makes iterating the replacements set more intuitive in Replacements class implementation. Previously, insertion is ordered before an deletion/replacement with the same offset, which is counter-intuitive for implementation, especially for a followup patch to support adding insertions around replacements.

With the current ordering, we only need to make `applyAllReplacements` iterate the replacements set reversely when applying them so that deletion/replacement is still applied before insertion with the same offset.

Reviewers: klimek, djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24663

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281819 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Tooling/Core/Replacement.h
lib/Tooling/Core/Replacement.cpp