[all-commits] [llvm/llvm-project] 04f4c4: [clangd] Move function body to out-of-line: unname...

Denis Fatkulin via All-commits all-commits at lists.llvm.org
Fri Feb 10 06:40:49 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04f4c4cc59db0f4db9cddcc5846d98491d4b65f5
  Author: Denis Fatkulin <fatkulin.denis at huawei.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
    M clang-tools-extra/clangd/unittests/tweaks/DefineOutlineTests.cpp

  Log Message:
  [clangd] Move function body to out-of-line: unnamed class method incorrect moving

The refactoring !!Move function body to out-of-line!! produces incorrect code for methods of unnamed classes.
For this simple example
  // foo.h
  struct Foo {
    struct {
      void f^oo() {}
    } Bar;

the refactoring generates code:
  // foo.cpp
  void Foo::(unnamed struct at D:\test\foo.h:2:3)foo() {}

Outplace definition for methods of unnamed classes is meaningless. The patch disables it.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D143638

More information about the All-commits mailing list