Commit Graph

2 Commits

Author SHA1 Message Date
Haojian Wu 3626516b14 [clang-move] Only move used helper declarations.
Summary:
Instead of moving all the helper declarations blindly, this patch
implements an AST-based call graph solution to make clang-move only move used
helper decls to new.cc and remove unused decls in old.cc.

Depends on D27674.

Reviewers: ioeric

Subscribers: mgorny, cfe-commits

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

llvm-svn: 290873
2017-01-03 09:00:51 +00:00
Haojian Wu 357ef99917 [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
2016-09-21 13:18:19 +00:00