[clang] [clang-refactor] Add Matcher Edit refactoring rule (PR #123782)
Roscoe A. Bartlett via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 05:36:38 PST 2025
=?utf-8?b?0JjQs9C90LDRgiDQodC10YDQsw=?=,
=?utf-8?b?0JjQs9C90LDRgiDQodC10YDQsw=?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/123782 at github.com>
bartlettroscoe wrote:
@IgnatSergeev, thanks for the detailed information on the clang-refactor testing infrastructure. We will try to run these tests and dig in deeper to see how the testing system works.
> I could add every piece of code related to those Refactoring Actions and tests here, and later remove them if needed.
No need for unnecessary work. We just appreciate your willingness to help answer our questions 😊
I have been looking for other PRs that extend clang-refactor, but it is hard to find them. There is not even a GitHub Issue label `clang-refactor`, so it is hard to find PRs and Issues specific to that tool. (Unlike for the tools with labels [`clang-tidy`](https://github.com/llvm/llvm-project/labels/clang-tidy) and [`clang-format`](https://github.com/llvm/llvm-project/labels/clang-format).)
> P. S. I'm using some Refactoring Engine terms here, if you are not sure, I recommend reading these docs [clang.llvm.org/docs/RefactoringEngine.html](https://clang.llvm.org/docs/RefactoringEngine.html)
Thanks! We have been looking that over.
Do you know why so few refactorings are supported in the `clang-refactor` tool or the [`clangd`](https://github.com/clangd/vscode-clangd/blob/master/README.md#refactoring) tool? For example, the `extract` function refactoring seems to only extracts a new function from a given range of code in a larger function. It does not seem refactor the larger original function to call the new extracted function (which is one of the most important parts of the classic ["Extract Method" refactoring](https://refactoring.guru/extract-method)). (We can't seem to find any examples of the usage of extract function. We determined this gap by experimentation.)
It seems that LLMV/Clang LibTool could support an endless set of refactorings (due to arbitrary AST changes), but there seems to be very limited user-ready refactorings supported by tools in the llvm-project repo itself. I know that major companies are using LLVM/Clang LibTool to do large refctorings. Are these companies mostly just developing their own proprietary in-house refactoring tools based on LLVM/Clang LibTool?
https://github.com/llvm/llvm-project/pull/123782
More information about the cfe-commits
mailing list