Currently this is limited to just defining method decls out of class in source files.
// Test.cpp struct A { void Foo() {} }; // Converted to struct A { void Foo(); }; A::Foo() {}
Paths
| Differential D148423
[clangd] Support define outline tweak for non cross file edits Needs ReviewPublic Authored by njames93 on Apr 15 2023, 3:03 AM.
Details
Diff Detail
Event TimelineComment Actions Theres definitely scope to improve this in follow ups. template <typename T> struct A { void [[Foo]]() {} template<typename U> void [[Bar]]() {} }; // Both ranges transformed to template <typename T> struct A { void Foo(); template<typename U> void Bar(); }; template <typename T> void A<T>::Foo() {} template <typename T> template <typename U> void A<T>::Bar<U>() {} In D147808 The restriction only only applying the tweak for non trivial member functions could be removed when making a non cross file edit. We could also employ a better insertion point logic for these tweaks as we have the full AST for the file where the function is to be inserted. Comment Actions
Revision Contents
Diff 513911 clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp
|