[PATCH] D147808: [clangd] Support non-trivial defaulted special member functions in Define Outline tweak

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 19 09:59:07 PDT 2023


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks a lot, and sorry for the delay!



================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:333
+        [](const syntax::Token &Tok) { return Tok.kind() == tok::equal; });
+    assert(Toks.size() == 2);
+    return {Toks.front().location(), Toks.back().endLocation()};
----------------
can you add a comment here saying `// We should have just ```= default``` in this case`


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:409
+        (!Source->doesThisDeclarationHaveABody() &&
+         (!Source->isExplicitlyDefaulted() || Source->isTrivial())) ||
         Source->isOutOfLine())
----------------
i know i asked for triviality check in the first version, but thinking a little bit more about it, users might be more confused about code action's availability. as this is very subtle at a glance for anyone but the compiler. so i think it's better to just emit it always.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147808



More information about the cfe-commits mailing list