]> granicus.if.org Git - clang/commit
[refactor] Initial outline of implementation of "extract function" refactoring
authorAlex Lorenz <arphaman@gmail.com>
Tue, 24 Oct 2017 17:18:45 +0000 (17:18 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 24 Oct 2017 17:18:45 +0000 (17:18 +0000)
commit58538f115416ae2ce6cc4cfa794d243bade5458d
treeec24dbb374fbc882e2168b3e71efa4ff0e9921fa
parent53710bdec511dfcfb69ee4d234b7f579b4955101
[refactor] Initial outline of implementation of "extract function" refactoring

This commit 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.
- simple literals and references are not extractable.

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

Differential Revision: https://reviews.llvm.org/D38982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316465 91177308-0d34-0410-b5e6-96231b3b80d8
15 files changed:
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 [new file with mode: 0644]
lib/Tooling/Refactoring/CMakeLists.txt
lib/Tooling/Refactoring/Extract.cpp [new file with mode: 0644]
test/Refactor/Extract/ExtractExprIntoFunction.cpp [new file with mode: 0644]
test/Refactor/LocalRename/Field.cpp
test/Refactor/LocalRename/NoSymbolSelectedError.cpp
test/Refactor/tool-test-support.c
tools/clang-refactor/TestSupport.cpp