[LibTooling] Add function to translate and validate source range for editing
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 18 Jul 2019 17:26:57 +0000 (17:26 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 18 Jul 2019 17:26:57 +0000 (17:26 +0000)
commit2e97a1e19ef5492a409d206bb544a746cd26360d
treea42b9ab74f13ff012147400069076ed5668c9d41
parentcfa14ac2a7768f90de3532833c88ccffd2ca0078
[LibTooling] Add function to translate and validate source range for editing

Summary:
Adds the function `getRangeForEdit` to validate that a given source range is
editable and, if needed, translate it into a range in the source file (for
example, if it's sourced in macro expansions).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 366469
clang/include/clang/Tooling/Refactoring/SourceCode.h
clang/lib/Tooling/Refactoring/SourceCode.cpp
clang/unittests/Tooling/SourceCodeTest.cpp