[PATCH] D122102: [clangd] Introduce "add subclass" tweak

Adrian Vogelsgesang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 20 07:49:57 PDT 2022


avogelsgesang created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman, mgorny.
Herald added a project: All.
avogelsgesang requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

This commit adds a new "add subclass" tweak which facilitates quick
scaffolding of inheritance hierarchies. The tweak can be triggered
on any class with virtual methods. It then inserts a new subclass
which overrides all virtual methods with dummy implementations.

There are two variations of this tweak:

1. A variant which overrides all virtual functions
2. A variant which overrides only pure virtual functions

This tweak also supports deeper inheritance hierarchies, and collects
the methods to be overriden not only from the immediate base class but
from the complete inheritance tree.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122102

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/AST.h
  clang-tools-extra/clangd/refactor/InsertionPoint.cpp
  clang-tools-extra/clangd/refactor/tweaks/AddSubclass.cpp
  clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
  clang-tools-extra/clangd/unittests/CMakeLists.txt
  clang-tools-extra/clangd/unittests/tweaks/AddSubclassTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122102.416785.patch
Type: text/x-patch
Size: 31456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220320/4217338f/attachment-0001.bin>


More information about the cfe-commits mailing list