[PATCH] D38982: [refactor] Initial outline of implementation of "extract function" refactoring

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 16:35:54 PDT 2017


arphaman created this revision.
Herald added a subscriber: mgorny.

This patch adds an initial, skeleton outline of the "extract function" refactoring.
The extracted function doesn't capture variables / rewrite code yet, it just basically does a simple copy-paste.
The following initiation rules are specified:

- extraction can only be done for executable code in a function/method/block. This means that you can't extract a global variable initialize into a function right now (should this be allowed though?).
- simple literals and references are not extractable.

This patch also adds support for full source ranges to clang-refactor's test mode.


Repository:
  rL LLVM

https://reviews.llvm.org/D38982

Files:
  include/clang/Basic/DiagnosticRefactoringKinds.td
  include/clang/Tooling/Refactoring/ASTSelection.h
  include/clang/Tooling/Refactoring/RefactoringActionRegistry.def
  include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
  include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
  include/clang/Tooling/Refactoring/RefactoringRuleContext.h
  lib/Tooling/Refactoring/ASTSelection.cpp
  lib/Tooling/Refactoring/ASTSelectionRequirements.cpp
  lib/Tooling/Refactoring/CMakeLists.txt
  lib/Tooling/Refactoring/Extract.cpp
  test/Refactor/Extract/ExtractExprIntoFunction.cpp
  test/Refactor/LocalRename/Field.cpp
  test/Refactor/tool-test-support.c
  tools/clang-refactor/TestSupport.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38982.119228.patch
Type: text/x-patch
Size: 27581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171016/8805450f/attachment-0001.bin>


More information about the cfe-commits mailing list