Commit Graph

22 Commits

Author SHA1 Message Date
Roman Lebedev 12b40745ab Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"
This reverts commit rL326202

This broke gcc4.8 builds, compiler just segfaults:
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673

llvm-svn: 326203
2018-02-27 15:54:41 +00:00
Roman Lebedev 6b56a11961 [Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Summary:
I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.

I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.

This is Clang-tools-extra part.
Clang part is D43779.

Reviewers: klimek, bkramer, alexfh, pcc

Reviewed By: alexfh

Subscribers: ioeric, jkorous-apple, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 326202
2018-02-27 15:19:28 +00:00
Haojian Wu fb68ca1825 [clang-move] Clever on handling header file which includes itself.
Summary:
Previously, we assume only old.cc includes "old.h", which would
introduce incorrect fixes for the cases where old.h also includes `#include "old.h"`

Although it should not be occurred in real projects, clang-move should handle this.

Old.h:

```
class Foo {};
```

after moving to a new old.h:

```
class Foo {};
```

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits, klimek

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

llvm-svn: 323865
2018-01-31 12:12:29 +00:00
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
Eric Liu 47a42d53fc [clang-move] ignore unsupported symbol kinds when checking if all symbols are moved.
llvm-svn: 288791
2016-12-06 10:12:23 +00:00
Haojian Wu 08e402ac93 [clang-move] some tweaks.
* Don't save SourceManager for each declarations.
* Rename some out-dated methods.

No functionality change.

llvm-svn: 288498
2016-12-02 12:39:39 +00:00
Haojian Wu b15c8da089 [clang-move] Enable dump all declarations in old header.
Summary:
* Add -dump_dels option to dump all declarations from old header. It
  will allow clang-move used as a frontend to get declarations from
  header. Further more, this will make debugging stuff easier. Currently only
  class/function types are supported.
* Refactoring code a little bit by creating a ClangMoveContext which
  holds all options for ClangMoveTool, which can simplify the code in
  some degree.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 287863
2016-11-24 10:17:17 +00:00
Haojian Wu 48ac304c8e [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
Summary:
* --new_depend_on_old: new header will include old header
* --old_depend_on_new: old header will include new header.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 287752
2016-11-23 10:04:19 +00:00
Haojian Wu 35ca946760 [clang-move] Abstract a ClassMather for matching class declarations.
Summary:
No functionality change.

This is a refactoring patch, which makes the code more readable and easy
to extend it to support more types.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286825
2016-11-14 14:15:44 +00:00
Simon Pilgrim 0e0f29c09f Fix -Wdocumentation warning
llvm-svn: 286449
2016-11-10 13:54:39 +00:00
Haojian Wu 2930be1421 [clang-move] Move all code from old.h/cc directly when moving all class declarations from old.h.
Summary: When moving all code to new.h/cc,  these code also will be formatted based on the given code style.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286281
2016-11-08 19:55:13 +00:00
Mandeep Singh Grang 7c7ea7d0ae [clang-tools-extra] Format sources with clang-format. NFC.
Summary:
Ran clang-format on all .c/.cpp/.h files in clang-tools-extra.
Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories.

Reviewers: klimek, alexfh

Subscribers: nemanjai

Tags: #clang-tools-extra

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

llvm-svn: 286221
2016-11-08 07:50:19 +00:00
Alexander Shaposhnikov 5fe0678bd8 [clang-move] Use cl::list for the list of names
This diff replaces manual parsing of the comma-separated list of names with 
cl::list and cl::CommaSeparated.
Test plan: make -j8 check-clang-tools

Differential revision: https://reviews.llvm.org/D25586

llvm-svn: 284291
2016-10-14 23:16:25 +00:00
Haojian Wu 9df3ac1f56 Recommit r283538 "[clang-move] Support moving multiple classes in one run."
llvm-svn: 284109
2016-10-13 08:48:42 +00:00
Renato Golin 0dccd1a0fd Revert "[clang-move] Support moving multiple classes in one run."
This reverts commit r283526 et al as it keeps randomly breaking bots, even after
the commit has gone, on other people's commit ranges.

Revert "[clang-move] Simplify lint tests" (r283545).
Revert "Fix buildbot error." (r283534).
Revert "Revert "fix buildbot error" since it is not right fix." (r283538).

llvm-svn: 283553
2016-10-07 13:58:10 +00:00
Haojian Wu a709e384ce [clang-move] Support moving multiple classes in one run.
Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 283526
2016-10-07 08:29:20 +00:00
Haojian Wu 9abbeaad55 [clang-move] Move comments which are associated with the moved class.
Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 283425
2016-10-06 08:59:24 +00:00
Haojian Wu 253d596d4a [clang-move] Cleanup around replacements.
Summary:
cleanup the remaining empty namespace after moving out the
class defintitions.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 283424
2016-10-06 08:29:32 +00:00
Haojian Wu ef445b7824 Fix a documentation warning.
llvm-svn: 283211
2016-10-04 10:40:52 +00:00
Haojian Wu d2a6d7b203 [clang-move] Make it support both relative and absolute file path arguments.
Reviewers: ioeric

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 283202
2016-10-04 09:05:31 +00:00
Haojian Wu daf4cb8b6a [clang-move] The new.cc file should include new_header.h instead of old_header.h
Summary:
Previously, all #includes (includeing old_header.h) in old.cc will be copied to new.cc,
however, the new.cc should include new_header.h instead of the old_header.h

Before applying the patch, the new.cc looks like:

```
#include "old_header.h"
...
```

The new.cc looks like with this patch:

```
#include "new_header"
...
```

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 282247
2016-09-23 13:28:38 +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