summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Transformer/Stencil.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libTooling] Add stencil combinators for nodes that may be pointers or values.Yitzhak Mandelbaum2019-11-221-4/+36
| | | | | | | | | | | | | | | | Summary: Adds combinators `maybeDeref` and `maybeAddressOf` to provide a uniform way to handle nodes which may be bound to either a pointer or a value (most often in the context of member expressions). Such polymorphism is already supported by `access`; these combinators extend it to more general uses. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70554
* [libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.Yitzhak Mandelbaum2019-11-111-25/+15
| | | | | | | | | | | | | | | | | | | | Summary: This revision introduces a new interface `MatchComputation` which generalizes the `Stencil` interface and replaces the `std::function` interface of `MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just one collection of implementations of `MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class entirely in favor of a simple type alias, deprecate `MatchConsumer` and change all functions that accepted `MatchConsumer<std::string>` to use `MatchComputation<std::string>` instead. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69802
* [libTooling] Simplify type structure of `Stencil`s.Yitzhak Mandelbaum2019-11-061-56/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, stencils are defined as a sequence of `StencilParts`. This differentiation adds an unneeded layer of complexity to the definition of Stencils. This change significantly simplifies the type structure: a stencil is now conceptually any object implementing `StencilInterface` and `Stencil` is just a thin wrapper for pointers to this interface. To account for the sequencing that was supported by the old `Stencil` type, we introduce a sequencing class that implements `StencilInterface`. That is, sequences are just another kind of Stencil and no longer have any special status. Corresponding to this change in the type structure, we change the way `cat` is used (and defined). `cat` bundles multiple features: it builds a stencil from a sequence of subcomponents and admits multiple different types for its arguments, while coercing them into the right type. Previously, `cat` was also used to coerce a single `StencilPart` into a `Stencil`. With that distinction gone, many uses of `cat` (e.g. in the tests) are unnecessary and have, therefore, been removed. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69613
* [libTooling] Put all Transformer declarations in a single namespace.Yitzhak Mandelbaum2019-10-161-19/+20
| | | | | | | | | | | | | | | | Summary: This revision introduces a new namespace, `clang::transformer`, to hold the declarations for the Transformer library. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68876 llvm-svn: 374962
* [libTooling] Change Stencil equality to use `toString()`Yitzhak Mandelbaum2019-10-111-55/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Removes the `isEqual` method from StencilPartInterface and modifies equality to use the string representation returned by the `toString` method for comparison. This means the `run` and `selection` stencils return true by default, and clients should be cautious in relying on equality operator for comparison of stencils containing parts generated by these functions. It also means we no longer need the custom RTTI support (typeId() and down_cast()), so it has been removed. Patch by Harshal T. Lehri. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68825 llvm-svn: 374552
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-101-0/+369
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
OpenPOWER on IntegriCloud