summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Refactoring/Stencil.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-101-369/+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] Add `toString` method to the Stencil classYitzhak Mandelbaum2019-10-071-0/+51
| | | | | | | | | | | | | | | | | Summary: `toString` generates a string representation of the stencil. Patch by Harshal T. Lehri. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68574 llvm-svn: 373916
* [libTooling] Add various Stencil combinators for expressions.Yitzhak Mandelbaum2019-10-031-1/+62
| | | | | | | | | | | | | | | | | | | Summary: This revision adds three new Stencil combinators: * `expression`, which idiomatically constructs the source for an expression, including wrapping the expression's source in parentheses if needed. * `deref`, which constructs an idiomatic dereferencing expression. * `addressOf`, which constructs an idiomatic address-taking expression. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68315 llvm-svn: 373593
* [Stencil] Hide implementaion detai. NFC.Benjamin Kramer2019-10-021-1/+1
| | | | llvm-svn: 373504
* [libTooling] Add `run` combinator to Stencils.Yitzhak Mandelbaum2019-09-261-0/+22
| | | | | | | | | | | | | | | | Summary: This revision adds `run`, a StencilPart that runs a user-defined function that computes a result over `MatchFinder::MatchResult`. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67969 llvm-svn: 372936
* [libTooling] Add `access` and `ifBound` combinators to Stencil library.Yitzhak Mandelbaum2019-09-231-17/+77
| | | | | | | | | | | | | | | | | | | | Summary: This revision add the `access` and `ifBound` combinators to the Stencil library: * `access` -- constructs an idiomatic expression for accessing a member (a `MemberExpr`). * `ifBound` -- chooses between two `StencilParts` based on the whether an id is bound in the match (corresponds to the combinator of the same name in RangeSelector). Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67633 llvm-svn: 372605
* [LibTooling] Update Stencil to use RangeSelectorYitzhak Mandelbaum2019-05-221-43/+18
| | | | | | | | | | | | | | | | | | | Add support for creating a `StencilPart` from any `RangeSelector`, which broadens the scope of `Stencil`. Correspondingly, deprecate Stencil's specialized combinators `node` and `sNode` in favor of using the new `selection` combinator directly (with the appropriate range selector). Reviewers: sbenza Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62160 llvm-svn: 361413
* [LibTooling] Fix unneeded use of unique_ptr where shared_ptr is expected.Yitzhak Mandelbaum2019-04-291-4/+5
| | | | | | | | | | | | | | Summary: This fixes a few places in the Stencil implementation where a unique_ptr is created at a callsite that expects shared_ptr. Since the former implicitly converts to the latter, the code compiles and runs correctly as is. But, there's no reason to involve unique_ptr -- the current code was leftover from a previous version in which unique_ptr was the expected type. Reviewers: sbenza Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61005 llvm-svn: 359468
* [LibTooling] Add Stencil library for format-string style codegen.Yitzhak Mandelbaum2019-04-181-0/+199
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
OpenPOWER on IntegriCloud