]> granicus.if.org Git - clang/commit
Supports adding insertion around non-insertion replacements.
authorEric Liu <ioeric@google.com>
Wed, 14 Sep 2016 13:04:51 +0000 (13:04 +0000)
committerEric Liu <ioeric@google.com>
Wed, 14 Sep 2016 13:04:51 +0000 (13:04 +0000)
commit8933d16ef8df7e334b51a66c908cf1681fbe9005
treefe5b4e7a092db2b595da7d49327ac4b1f7311c4f
parentb19f8fa7328ea6963987cc52ecf46cde361cb181
Supports adding insertion around non-insertion replacements.

Summary:
Extend `tooling::Replacements::add()` to support adding order-independent replacements.

Two replacements are considered order-independent if one of the following conditions is true:
  - They do not overlap. (This is already supported.)
  - One replacement is insertion, and the other is a replacement with
    length > 0, and the insertion is adjecent to but not contained in the
    other replacement. In this case, the replacement should always change
    the original code instead of the inserted text.

Reviewers: klimek, djasper

Subscribers: cfe-commits, klimek

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

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