[all-commits] [llvm/llvm-project] 7355ea: [clangd] Add tweak to override pure virtuals (#139...

Marco Maia via All-commits all-commits at lists.llvm.org
Mon Jul 21 00:36:29 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7355ea3f6b214d1569da43d02f9a166ff15012e6
      https://github.com/llvm/llvm-project/commit/7355ea3f6b214d1569da43d02f9a166ff15012e6
  Author: Marco Maia <marcogmaia at gmail.com>
  Date:   2025-07-21 (Mon, 21 Jul 2025)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
    A clang-tools-extra/clangd/refactor/tweaks/OverridePureVirtuals.cpp
    M clang-tools-extra/clangd/unittests/CMakeLists.txt
    A clang-tools-extra/clangd/unittests/tweaks/OverridePureVirtualsTests.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst

  Log Message:
  -----------
  [clangd] Add tweak to override pure virtuals (#139348)

closes https://github.com/clangd/clangd/issues/1037 
closes https://github.com/clangd/clangd/issues/2240

Example:

```c++
class Base {
public:
  virtual void publicMethod() = 0;

protected:
  virtual auto privateMethod() const -> int = 0;
};

// Before:
//                        // cursor here
class Derived : public Base{}^ ;

// After:
class Derived : public Base {
public:
  void publicMethod() override {
    // TODO: Implement this pure virtual method.
    static_assert(false, "Method `publicMethod` is not implemented.");
  }

protected:
  auto privateMethod() const -> int override {
    // TODO: Implement this pure virtual method.
    static_assert(false, "Method `privateMethod` is not implemented.");
  }
};
```


https://github.com/user-attachments/assets/79de40d9-1004-4c2e-8f5c-be1fb074c6de

---------

Co-authored-by: Marco Maia <marco.maia at iarasystems.com.br>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list