[PATCH] D36075: [refactor] Initial support for refactoring action rules

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 04:49:31 PDT 2017


arphaman added inline comments.


================
Comment at: include/clang/Tooling/Refactoring/RefactoringResult.h:21
+struct RefactoringResult {
+  enum ResultKind {
+    /// A set of source replacements represented using a vector of
----------------
ioeric wrote:
> I'm a bit unsure about the abstraction of the refactoring result. I would expected refactoring results to be source changes always. Do you have any refactoring tool that outputs occurrences in mind?
In Xcode we require rename to return symbol occurrences because the IDE is responsible for figuring out: 
1) The new name. Thus we can't produce replacements when renaming because we don't know what the new name is when gathering the occurrences.
2) Whether these occurrences should be actually applied. Thus we can't produce replacements because it's up to the user to decide if they want to rename some occurrence in a comment for example.

In general 2) can be applied to tools like clang-refactor that could allow users to select occurrences that don't guarantee a direct semantic match (comments, etc.) in an interactive manner.

I think clangd has a rather naive rename support, so these points may not apply, but we may want to extend clangd's support for rename in the future as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D36075





More information about the cfe-commits mailing list