[all-commits] [llvm/llvm-project] ce2b5c: [libTooling] Simplify type structure of `Stencil`s.

Yitzhak Mandelbaum via All-commits all-commits at lists.llvm.org
Wed Nov 6 07:42:24 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ce2b5cb6decb5cce32adde0d23bdea521da0908b
      https://github.com/llvm/llvm-project/commit/ce2b5cb6decb5cce32adde0d23bdea521da0908b
  Author: Yitzhak Mandelbaum <yitzhakm at google.com>
  Date:   2019-11-06 (Wed, 06 Nov 2019)

  Changed paths:
    M clang/include/clang/Tooling/Transformer/Stencil.h
    M clang/lib/Tooling/Transformer/Stencil.cpp
    M clang/unittests/Tooling/StencilTest.cpp

  Log Message:
  -----------
  [libTooling] Simplify type structure of `Stencil`s.

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




More information about the All-commits mailing list