[clang-tools-extra] [clangd] Allow "move function body out-of-line" in non-header files (PR #69704)

Christian Kandeler via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 07:41:32 PST 2023


================
@@ -349,6 +358,36 @@ TEST_F(DefineOutlineTest, ApplyTest) {
   }
 }
 
+TEST_F(DefineOutlineTest, InCppFile) {
+  FileName = "Test.cpp";
+
+  struct {
+    llvm::StringRef Test;
+    llvm::StringRef ExpectedSource;
+  } Cases[] = {
+      {
+          R"cpp(
+            namespace foo {
+            namespace {
+            struct Foo { void ba^r() {} };
----------------
ckandeler wrote:

> so what about changing this logic to get to enclosing decl instead (i.e. TagDecl) and insert right after its end location?

That will break with nested classes, won't it?

https://github.com/llvm/llvm-project/pull/69704


More information about the cfe-commits mailing list