[clang-move] A prototype tool for moving class definition to new file.
authorHaojian Wu <hokein@google.com>
Wed, 21 Sep 2016 13:18:19 +0000 (13:18 +0000)
committerHaojian Wu <hokein@google.com>
Wed, 21 Sep 2016 13:18:19 +0000 (13:18 +0000)
commit357ef999170fcda8b57551da1e5837a615cac1d5
tree7afe40f67bdc36e9cb0a56da6c631a16d8664aed
parent9a46718378550a33236ba73dcf6a7df31e01c27a
[clang-move] A prototype tool for moving class definition to new file.

Summary:
This patch introduces a new tool which moves a specific class definition
from files (.h, .cc) to new files (.h, .cc), which mostly acts like
"Extract class defintion". In the long term, this tool should be
merged in to clang-refactoring as a subtool.

clang-move not only moves class definition, but also moves all the
forward declarations, functions defined in anonymous namespace and #include
headers to new files, to make sure the new files are compliable as much
as possible.

To move `Foo` from old.[h/cc] to new.[h/cc], use:

```
clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h
-new_cc=new.cc old.cc
```

To move `Foo` from old.h to new.h, use:

```
clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc
```

Reviewers: klimek, djasper, ioeric

Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits

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

llvm-svn: 282070
clang-tools-extra/CMakeLists.txt
clang-tools-extra/clang-move/CMakeLists.txt [new file with mode: 0644]
clang-tools-extra/clang-move/ClangMove.cpp [new file with mode: 0644]
clang-tools-extra/clang-move/ClangMove.h [new file with mode: 0644]
clang-tools-extra/clang-move/tool/CMakeLists.txt [new file with mode: 0644]
clang-tools-extra/clang-move/tool/ClangMoveMain.cpp [new file with mode: 0644]
clang-tools-extra/unittests/CMakeLists.txt
clang-tools-extra/unittests/clang-move/CMakeLists.txt [new file with mode: 0644]
clang-tools-extra/unittests/clang-move/ClangMoveTests.cpp [new file with mode: 0644]