summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Refactoring/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-101-5/+0
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 llvm-svn: 374271
* [libTooling] Introduce new library of source-code builders.Yitzhak Mandelbaum2019-09-231-0/+1
| | | | | | | | | | | | | | | | | Summary: Introduces facilities for easily building source-code strings, including idiomatic use of parentheses and the address-of, dereference and member-access operators (dot and arrow) and queries about need for parentheses. Reviewers: gribozavr Subscribers: mgorny, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D67632 llvm-svn: 372595
* Rename clangToolingRefactor to clangToolingRefactoring for consistency with ↵Nico Weber2019-05-251-1/+1
| | | | | | | | | | its directory See "[cfe-dev] The name of clang/lib/Tooling/Refactoring". Differential Revision: https://reviews.llvm.org/D62420 llvm-svn: 361684
* [LibTooling] Add RangeSelector library for defining source ranges based on ↵Yitzhak Mandelbaum2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | bound AST nodes. Summary: The RangeSelector library defines a combinator language for specifying source ranges based on bound ids for AST nodes. The combinator approach follows the design of the AST matchers. The RangeSelectors defined here will be used in both RewriteRule, for specifying source affected by edit, and in Stencil for specifying source to use constructively in a replacement. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61774 llvm-svn: 361152
* [LibTooling] Add Stencil library for format-string style codegen.Yitzhak Mandelbaum2019-04-181-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: This file defines the *Stencil* abstraction: a code-generating object, parameterized by named references to (bound) AST nodes. Given a match result, a stencil can be evaluated to a string of source code. A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to nodes (the parameters) and helper code-generation operations. See thread on cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling" for background. Reviewers: sbenza Reviewed By: sbenza Subscribers: ilya-biryukov, mgorny, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59371 llvm-svn: 358691
* [LibTooling] Add Transformer, a library for source-to-source transformations.Yitzhak Mandelbaum2019-04-051-0/+1
| | | | | | | | | | | | | | | | Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations. A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling". Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, ABataev, mgorny, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59376 llvm-svn: 357768
* [LibTooling] Add "SourceCode" library for functions relating to source-code ↵Yitzhak Mandelbaum2019-04-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | manipulation. Summary: Introduces a utility library in Refactoring/ to collect routines related to source-code manipulation. In this change, we move "extended-range" functions from the FixIt library (in clangTooling) to this new library. We need to use this functionality in Refactoring/ and cannot access it if it resides in Tooling/, because that would cause clangToolingRefactor to depend on clangTooling, which would be a circular dependency. Reviewers: ilya-biryukov, ioeric Reviewed By: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60269 llvm-svn: 357764
* Revert "[LibTooling] Add Transformer, a library for source-to-source ↵Alexey Bataev2019-04-031-1/+0
| | | | | | | | | transformations." This reverts commit r357576 to fix the problem with the cyclic dependencies between libTooling and libToolingRefactor. llvm-svn: 357612
* [LibTooling] Add Transformer, a library for source-to-source transformations.Yitzhak Mandelbaum2019-04-031-0/+1
| | | | | | | | | | | | | | | | Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations. A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling". Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: mgorny, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59376 llvm-svn: 357576
* [refactor][extract] insert semicolons into extracted/inserted codeAlex Lorenz2017-11-031-1/+2
| | | | | | | | | | | | | | | | | | when needed This commit implements the semicolon insertion logic into the extract refactoring. The following rules are used: - extracting expression: add terminating ';' to the extracted function. - extracting statements that don't require terminating ';' (e.g. switch): add terminating ';' to the callee. - extracting statements with ';': move (if possible) the original ';' from the callee and add terminating ';'. - otherwise, add ';' to both places. Differential Revision: https://reviews.llvm.org/D39441 llvm-svn: 317343
* Add missing clangRewrite lib dependency for clangToolingRefactorAlex Lorenz2017-10-241-0/+1
| | | | llvm-svn: 316467
* [refactor] Initial outline of implementation of "extract function" refactoringAlex Lorenz2017-10-241-0/+2
| | | | | | | | | | | | | | | | | | | 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
* [refactor] Simplify the refactoring interfaceAlex Lorenz2017-10-021-1/+0
| | | | | | | | | | | | | This commit simplifies the interface for the refactoring action rules and the refactoring requirements. It merges the selection constraints and the selection requirements into one class. The refactoring actions rules must now be implemented using subclassing instead of raw function / lambda pointers. This change also removes a bunch of template-based traits and other template definitions that are now redundant. Differential Revision: https://reviews.llvm.org/D37681 llvm-svn: 314704
* [refactor] add clang-refactor tool with initial testing support andAlex Lorenz2017-09-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 313244
* [refactor] initial support for refactoring action rulesAlex Lorenz2017-08-281-0/+1
| | | | | | | | | | | | | | | | | | This patch implements the initial support for refactoring action rules. The first rule that's supported is a "source change" rule that returns a set of atomic changes. This patch is based on the ideas presented in my RFC: http://lists.llvm.org/pipermail/cfe-dev/2017-July/054831.html The following pieces from the RFC are added by this patch: - `createRefactoringRule` (known as `apply` in the RFC) - `requiredSelection` refactoring action rule requirement. - `selection::SourceSelectionRange` selection constraint. Differential Revision: https://reviews.llvm.org/D36075 llvm-svn: 311884
* [refactor] Add the AST source selection componentAlex Lorenz2017-08-241-0/+1
| | | | | | | | | | | | | This commit adds the base AST source selection component to the refactoring library. AST selection is represented using a tree of SelectedASTNode values. Each selected node gets its own selection kind, which can actually be None even in the middle of tree (e.g. statement in a macro whose child is in a macro argument). The initial version constructs a "raw" selection tree, without applying filters and canonicalisation operations to the nodes. Differential Revision: https://reviews.llvm.org/D35012 llvm-svn: 311655
* [rename] Introduce symbol occurrencesAlex Lorenz2017-08-141-0/+1
| | | | | | | | | | | Symbol occurrences store the results of local rename and will also be used for the global, indexed rename results. Their kind is used to determine whether they should be renamed automatically or not. They can be converted to a set of AtomicChanges as well. Differential Revision: https://reviews.llvm.org/D36156 llvm-svn: 310853
* Added `applyAtomicChanges` function.Eric Liu2017-07-311-4/+2
| | | | | | | | | | | | | | | | | | This re-commits r298913. o See thread http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170327/189084.html o Tested with -DLLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY=0. Summary: ... which applies a set of `AtomicChange`s on code. Reviewers: klimek, djasper Reviewed By: djasper Subscribers: arphaman, mgorny, chapuni, cfe-commits Differential Revision: https://reviews.llvm.org/D30777 llvm-svn: 309548
* [refactor] Move clang-rename into the clang repositoryAlex Lorenz2017-06-301-0/+8
| | | | | | | | | | | | The core engine of clang-rename will be used for local and global renames in the new refactoring engine, as mentioned in http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html. The clang-rename tool is still supported but might get deprecated in the future. Differential Revision: https://reviews.llvm.org/D34696 llvm-svn: 306840
* Revert "clangToolingRefactor: Add libdeps upon clangFormat in r298913."Juergen Ributzka2017-03-291-1/+0
| | | | llvm-svn: 298965
* clangToolingRefactor: Add libdeps upon clangFormat in r298913.NAKAMURA Takumi2017-03-281-0/+1
| | | | llvm-svn: 298921
* Introducing clang::tooling::AtomicChange for refactoring tools.Eric Liu2017-03-011-0/+12
Summary: An AtomicChange is used to create and group a set of source edits, e.g. replacements or header insertions. Edits in an AtomicChange should be related, e.g. replacements for the same type reference and the corresponding header insertion/deletion. An AtomicChange is uniquely identified by a key position and will either be fully applied or not applied at all. The key position should be the location of the key syntactical element that is being changed, e.g. the call to a refactored method. Next step: add a tool that applies AtomicChange. Reviewers: klimek, djasper Reviewed By: klimek Subscribers: alexshap, cfe-commits, djasper, mgorny Differential Revision: https://reviews.llvm.org/D27054 llvm-svn: 296616
OpenPOWER on IntegriCloud