[PATCH] D116514: [clangd] Add code action to generate a constructor for a C++ class

Adrian Vogelsgesang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 18 09:38:20 PST 2022


avogelsgesang added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/MemberwiseConstructor.cpp:26-28
+//   struct S {
+//     S(int x, unique_ptr<double> y) : x(x), y(std::move(y)) {}
+//   };
----------------
njames93 wrote:
> avogelsgesang wrote:
> > ```
> > // e.g. given `struct S{ int x; unique_ptr<double> y; };`, produces:
> > //   struct S {
> > //     int x; unique_ptr<double> y;
> > //     S(int x, unique_ptr<double> y) : x(x), y(std::move(y)) {}
> > //   };
> > ```
> > or just
> > ```
> > // e.g. given `struct S{ int x; unique_ptr<double> y; };`, produces:
> > //     S(int x, unique_ptr<double> y) : x(x), y(std::move(y)) {}
> > ```
> > 
> > The tweak does not remove the members, as currently suggested by the comment
> That's just a bad comment, the tweak won't remove the members
I know. Let's fix the comment :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116514/new/

https://reviews.llvm.org/D116514



More information about the cfe-commits mailing list