]> granicus.if.org Git - clang/commit
[libTooling] Transformer: refine `SourceLocation` specified as anchor of changes.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Fri, 27 Sep 2019 15:26:04 +0000 (15:26 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Fri, 27 Sep 2019 15:26:04 +0000 (15:26 +0000)
commit03bc7eb123db247215352c11ffd8569ea2770d11
treee11e743af14f645909eb9a13a418bfbd8c26db0e
parent1a6bed77c7bab29e82b40c05f3ff89b97b05a027
[libTooling] Transformer: refine `SourceLocation` specified as anchor of changes.

Summary: Every change triggered by a rewrite rule is anchored at a particular
location in the source code.  This patch refines how that location is chosen and
defines it as an explicit function so it can be shared by other Transformer
implementations.

This patch was inspired by a bug found by a clang tidy, wherein two changes were
anchored at the same location (the expansion loc of the macro) resulting in the
discarding of the second change.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373093 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Tooling/Refactoring/Transformer.h
lib/Tooling/Refactoring/Transformer.cpp
unittests/Tooling/TransformerTest.cpp