This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Code action to declare missing move/copy constructor/assignment
ClosedPublic

Authored by sammccall on Jan 1 2022, 8:01 PM.

Diff Detail

Event Timeline

sammccall created this revision.Jan 1 2022, 8:01 PM
sammccall requested review of this revision.Jan 1 2022, 8:01 PM
sammccall updated this revision to Diff 396949.Jan 2 2022, 2:16 PM

Oops, forgot the implementation

sammccall updated this revision to Diff 396950.Jan 2 2022, 2:19 PM

oops, and the test

hokein added inline comments.Jan 10 2022, 3:26 AM
clang-tools-extra/clangd/refactor/tweaks/SpecialMembers.cpp
73

nit: add trigger points.

121

I think we need this because these members are created lazily in clang, e.g. if the empty struct s is not used, there is no constructor decl being created.

The ForceDeclarationOfImplicitMembers is a member function which can mutate the parameter Class, I was wondering whether it would lead some bad side-effect, but I didn't come out one (and the mutation is mostly creating a new ctor-decl and adding it to the Class).

147

nit: add default value

nridge added a subscriber: nridge.Jan 12 2022, 8:56 PM
sammccall marked 3 inline comments as done.

Oops, this never got landed!

Address comments

Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 10:45 AM
sammccall added inline comments.Mar 31 2022, 7:19 AM
clang-tools-extra/clangd/refactor/tweaks/SpecialMembers.cpp
121

That's right. Rewrote the comment to make it clearer that these are lazily created (which is why I think it's safe to create them)

hokein accepted this revision.Apr 1 2022, 1:40 AM
This revision is now accepted and ready to land.Apr 1 2022, 1:40 AM