[PATCH] D69632: [libTooling] Add Stencil constructor.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 09:09:25 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e759daf2ea8: [libTooling] Add Stencil constructor. (authored by ymandel).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69632/new/

https://reviews.llvm.org/D69632

Files:
  clang/include/clang/Tooling/Transformer/Stencil.h


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===================================================================
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector<StencilPart> Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template <typename... Ts> static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template <typename... Ts> Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward<Ts>(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil catVector(std::vector<StencilPart> Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69632.227464.patch
Type: text/x-patch
Size: 989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191101/13be6496/attachment-0001.bin>


More information about the cfe-commits mailing list