[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)
commit7fe441b20d2db1d51f12921e5f5f6440db808daa
tree85fb0c94f7d6426dbb309017381c09a6ca91a767
parent3fe15ee8fe3d5696aa4e5a605f3f270d13a6040e
[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

llvm-svn: 316465
15 files changed:
clang/include/clang/Basic/DiagnosticRefactoringKinds.td
clang/include/clang/Tooling/Refactoring/ASTSelection.h
clang/include/clang/Tooling/Refactoring/RefactoringActionRegistry.def
clang/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h
clang/lib/Tooling/Refactoring/ASTSelection.cpp
clang/lib/Tooling/Refactoring/ASTSelectionRequirements.cpp [new file with mode: 0644]
clang/lib/Tooling/Refactoring/CMakeLists.txt
clang/lib/Tooling/Refactoring/Extract.cpp [new file with mode: 0644]
clang/test/Refactor/Extract/ExtractExprIntoFunction.cpp [new file with mode: 0644]
clang/test/Refactor/LocalRename/Field.cpp
clang/test/Refactor/LocalRename/NoSymbolSelectedError.cpp
clang/test/Refactor/tool-test-support.c
clang/tools/clang-refactor/TestSupport.cpp