]> granicus.if.org Git - clang/commit
[refactor] add clang-refactor tool with initial testing support and
authorAlex Lorenz <arphaman@gmail.com>
Thu, 14 Sep 2017 10:06:52 +0000 (10:06 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Thu, 14 Sep 2017 10:06:52 +0000 (10:06 +0000)
commit5a2269c689fbe654ff15a8783bd61b1047353b67
treeeaebdcfa15e9243d14d3f31794f96cff20267337
parentf9eb14961ddd9a48da63cdb792d06386287a5dfd
[refactor] add clang-refactor tool with initial testing support and
local-rename action

This commit introduces the clang-refactor tool alongside the local-rename action
which uses the existing renaming engine used by clang-rename. The tool
doesn't actually perform the source transformations yet, it just provides
testing support. This commit also moves only one test from clang-rename over to
test/Refactor. I will continue to move the other tests throughout
development of clang-refactor.

The following options are supported by clang-refactor:

-v: use verbose output
-selection: The source range that corresponds to the portion of the source
 that's selected (currently only special command test:<file> is supported).

Please note that a follow-up commit will migrate clang-refactor to
libTooling's common option parser, so clang-refactor will be able to use
the common interface with compilation database and options like -p, -extra-arg,
etc.

The testing support provided by clang-refactor is described below:

When -selection=test:<file> is given, clang-refactor will parse the selection
commands from that file. The selection commands are grouped and the specified
refactoring action invoked by the tool. Each command in a group is expected to
produce an identical result. The precise syntax for the selection commands is
described in a comment in TestSupport.h.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313244 91177308-0d34-0410-b5e6-96231b3b80d8
27 files changed:
include/clang/Tooling/Refactoring/AtomicChange.h
include/clang/Tooling/Refactoring/RefactoringAction.h [new file with mode: 0644]
include/clang/Tooling/Refactoring/RefactoringActionRegistry.def [new file with mode: 0644]
include/clang/Tooling/Refactoring/RefactoringActionRule.h
include/clang/Tooling/Refactoring/RefactoringActionRuleRequirementsInternal.h
include/clang/Tooling/Refactoring/RefactoringActionRules.h
include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
include/clang/Tooling/Refactoring/RefactoringRuleContext.h
include/clang/Tooling/Refactoring/Rename/USRFindingAction.h
include/clang/Tooling/Refactoring/SourceSelectionConstraints.h
include/clang/module.modulemap
lib/Tooling/Refactoring/AtomicChange.cpp
lib/Tooling/Refactoring/CMakeLists.txt
lib/Tooling/Refactoring/RefactoringActions.cpp [new file with mode: 0644]
lib/Tooling/Refactoring/Rename/RenamingAction.cpp
lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
test/CMakeLists.txt
test/Refactor/LocalRename/Field.cpp [new file with mode: 0644]
test/Refactor/tool-common-options.c [new file with mode: 0644]
test/Refactor/tool-test-support.c [new file with mode: 0644]
test/clang-rename/Field.cpp [deleted file]
tools/CMakeLists.txt
tools/clang-refactor/CMakeLists.txt [new file with mode: 0644]
tools/clang-refactor/ClangRefactor.cpp [new file with mode: 0644]
tools/clang-refactor/TestSupport.cpp [new file with mode: 0644]
tools/clang-refactor/TestSupport.h [new file with mode: 0644]
unittests/Tooling/RefactoringActionRulesTest.cpp