This is an archive of the discontinued LLVM Phabricator instance.

[clang-move] Support moving multiple classes in one run.
ClosedPublic

Authored by hokein on Oct 6 2016, 3:42 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein updated this revision to Diff 73756.Oct 6 2016, 3:42 AM
hokein retitled this revision from to [clang-move] Support moving multiple classes in one run..
hokein updated this object.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.
ioeric added inline comments.Oct 6 2016, 9:49 AM
clang-move/ClangMove.cpp
295 ↗(On Diff #73756)

Why create this lambda if it's only used once? I think you can save a few lines by just inlining this.

303 ↗(On Diff #73756)

I'd also allow whitespaces around separators, e.g. a::b::X, a::b::Y. Maybe also trim() the name.

304 ↗(On Diff #73756)

Does this work?

InMovedClassNames = InMovedClassNames ? ... : ...
316 ↗(On Diff #73756)

What would happen if InMovedClassNames == false?

clang-move/ClangMove.h
40 ↗(On Diff #73756)

I'd use commas as separator. Eyeballs can easily mix ";" with ":".

clang-move/tool/ClangMoveMain.cpp
41 ↗(On Diff #73756)

Same here if semi->comma.

And I'd name this Names and names

test/clang-move/Inputs/multiple_class_test.cpp
15 ↗(On Diff #73756)

Can you add one more moved class that is also in namespace c?

hokein updated this revision to Diff 73819.Oct 6 2016, 10:21 AM
hokein marked 7 inline comments as done.

Address review comments.

clang-move/ClangMove.cpp
316 ↗(On Diff #73756)

"InMovedClassNames" should not be false in the matcher. Added an assert.

ioeric added inline comments.Oct 6 2016, 10:47 AM
clang-move/ClangMove.cpp
299 ↗(On Diff #73819)

The comment is trivial.

302 ↗(On Diff #73819)

Can we use trim() with default argument?

316 ↗(On Diff #73756)

I think you should instead exit early if ClassNames.empty() or assert not empty.

test/clang-move/Inputs/multiple_class_test.cpp
19 ↗(On Diff #73819)

What I wanted to see is another *moved* class because there was no test case where multiple classes are moved into the same namespace.

hokein updated this revision to Diff 73888.Oct 7 2016, 1:07 AM
hokein marked 3 inline comments as done.

Update.

ioeric accepted this revision.Oct 7 2016, 1:14 AM
ioeric edited edge metadata.

Lg. Thanks!

This revision is now accepted and ready to land.Oct 7 2016, 1:14 AM
ioeric added inline comments.Oct 7 2016, 1:56 AM
clang-move/ClangMove.cpp
291–297 ↗(On Diff #73888)

Spamming.

Test phabricator.

316 ↗(On Diff #73756)

Test nested comments.

This revision was automatically updated to reflect the committed changes.