[libTooling] Fix bug in Stencil handling of macro ranges
authorYitzhak Mandelbaum <yitzhakm@google.com>
Mon, 6 Jan 2020 16:00:44 +0000 (11:00 -0500)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Fri, 17 Jan 2020 17:11:25 +0000 (12:11 -0500)
commitb9d2bf38e86e6dd8a2f188d9a24f546aa67de8af
treed167dce73aa11628a8a82145a6b8f4f8fbc14f6f
parent522c030aa9b1dd1881feb5a0d0fa2639b4a5feb7
[libTooling] Fix bug in Stencil handling of macro ranges

Summary: Currently, an attempt to rewrite source code inside a macro expansion succeeds, but results in empty text, rather than failing with an error.  This patch restructures to the code to explicitly validate ranges before attempting to edit them.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72274
clang/include/clang/Tooling/Transformer/SourceCode.h
clang/lib/Tooling/Transformer/SourceCode.cpp
clang/lib/Tooling/Transformer/Stencil.cpp
clang/unittests/Tooling/SourceCodeTest.cpp
clang/unittests/Tooling/StencilTest.cpp