This is an archive of the discontinued LLVM Phabricator instance.

[clang-move] Support template class.
ClosedPublic

Authored by hokein on Nov 8 2016, 2:26 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein updated this revision to Diff 77263.Nov 8 2016, 2:26 PM
hokein retitled this revision from to [clang-move] Support template class..
hokein updated this object.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.
ioeric edited edge metadata.Nov 8 2016, 4:21 PM

Nice!

First round of comments.

clang-move/ClangMove.cpp
414 ↗(On Diff #77263)

Some comments here would be appreciated.

Also nit: no braces.

427 ↗(On Diff #77263)

Same as above. Comments and braces.

test/clang-move/move-template-class.cpp
20 ↗(On Diff #77263)

Not directly related, but we might want to start thinking about appropriate code formatting like spaces between decls. Code jamming together is not pretty...

hokein updated this revision to Diff 77292.Nov 8 2016, 5:02 PM
hokein marked 3 inline comments as done.
hokein edited edge metadata.

Add comments.

ioeric accepted this revision.Nov 9 2016, 11:18 AM
ioeric edited edge metadata.

Lg with a few nits.

clang-move/ClangMove.cpp
417 ↗(On Diff #77292)

erase(FTD ? FTD : CMD)

430 ↗(On Diff #77292)

emplace_back(TC ? TC : CD, ...)

440 ↗(On Diff #77292)

Similarly.

This revision is now accepted and ready to land.Nov 9 2016, 11:18 AM
hokein marked 3 inline comments as done.Nov 9 2016, 12:03 PM
hokein added inline comments.
clang-move/ClangMove.cpp
417 ↗(On Diff #77292)

We can't write the code like this way since the ternary operator (condition ? E1:E2) requires E1 and E2 has same type or they can convert to each other. In our case, the pointer types of FTD and CMD are different, and they can't convert to each other.

We could pass the compilation by writing the code like following way, but I'd keep the current way.

erase(FTD ? static_cast<NamedDecl*>(FTD) : static_cast<NamedDecl*>CMD);
ioeric added inline comments.Nov 9 2016, 12:07 PM
clang-move/ClangMove.cpp
417 ↗(On Diff #77292)

nvm. you can keep it as it is.

This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.