[clangd] Delete ctor initializers while moving functions out-of-line
authorKadir Cetinkaya <kadircet@google.com>
Mon, 9 Dec 2019 10:54:21 +0000 (11:54 +0100)
committerKadir Cetinkaya <kadircet@google.com>
Mon, 9 Dec 2019 17:52:57 +0000 (18:52 +0100)
commita209a8000e17ef3560598a44825747aab2f7914d
tree6bd92bb27fb57a4ed27ab92975f3084178250c99
parent898d7a0695c577b8cfe3b86b974b71f1ecb3e6c2
[clangd] Delete ctor initializers while moving functions out-of-line

Summary:
Currently we only delete function body from declaration, in addition to
that we should also drop ctor initializers.

Unfortunately CXXConstructorDecl doesn't store the location of `:` before
initializers, therefore we make use of token buffer to figure out where to start
deletion.

Fixes https://github.com/clangd/clangd/issues/220

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71188
clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
clang-tools-extra/clangd/unittests/TweakTests.cpp