Add functions to apply replacements and reformat them.
authorManuel Klimek <klimek@google.com>
Tue, 1 Mar 2016 12:37:30 +0000 (12:37 +0000)
committerManuel Klimek <klimek@google.com>
Tue, 1 Mar 2016 12:37:30 +0000 (12:37 +0000)
commitb12e5a5ccd8e5ca71a3722a4b5103a794ca5515f
tree2be713f424b906e73a5320edca75855f6b37226e
parent109702ccb16f33a5b0305a1d1287413c9a88adca
Add functions to apply replacements and reformat them.

This is a commonly useful feature to have, and we have implemented it
multiple times with different kinds of bugs. This implementation
centralizes the idea in a set of functions that we can then use from the various
tools.

Reverts r262234, which is a revert of r262232, and puts the functions
into FOrmat.h, as they are closely coupled to clang-format, and we
otherwise introduce a cyclic dependency between libFormat and
libTooling.

Patch by Eric Liu.

llvm-svn: 262323
clang/include/clang/Format/Format.h
clang/include/clang/Tooling/Core/Replacement.h
clang/lib/Format/Format.cpp
clang/lib/Tooling/Core/Replacement.cpp
clang/unittests/Format/CMakeLists.txt
clang/unittests/Format/FormatTest.cpp
clang/unittests/Tooling/RefactoringTest.cpp