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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 16 00:27:18 PST 2022


njames93 added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/MemberwiseConstructor.cpp:203
+      return CopyRef;
+    return Fail;
+  }
----------------
If C is default constructible, would it be nice to skip here instead of failing?


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/MemberwiseConstructor.cpp:211
+    if (Fields.size() == 1)
+      OS << "explicit ";
+    OS << Class->getName() << "(";
----------------
Some codebases may not want these to be explicit, would it be wiser to use config to control this?


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